PrefectAmazon ECS

Pydantic MockValSer serialization error prevents container flow startup

critical
availabilityUpdated May 14, 2025(via Exa)
How to detect:

When containerized flows (particularly on AWS ECS) attempt to communicate cancellation state back to Prefect server in version 3.4.1, Pydantic encounters MockValSer serialization error during model_dump operation. Affects 20-30% of flow runs, preventing them from starting with ExceptionGroup containing TypeError during _mark_flow_run_as_cancelled.

Recommended action:

Upgrade to Prefect version including PR #20127 fix. Temporary workaround: revert to commit before 378fc4f6b7, or patch by reverting commits 6869a02a04 and 378fc4f6b7 from version 3.4.1. Monitor ECS task logs for TypeError during state serialization.