<@ULVA73B9P> | return await self._client.send(...
# ask-marvin
a
@Marvin | return await self._client.send(request) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 354, in send | response.raise_for_status() | File "/usr/local/lib/python3.11/site-packages/prefect/client/base.py", line 162, in raise_for_status | raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.cause | prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url 'http://prefect-server/api/deployments/dd23cda3-c3b8-4deb-bb2a-d5b664c494ac' | Response: {'detail': 'Deployment not found'} | For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 | | The above exception was the direct cause of the following exception: | | Traceback (most recent call last): | File "/usr/local/lib/python3.11/site-packages/prefect/workers/process.py", line 442, in cancel_run | configuration = await self._get_configuration(flow_run) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/prefect/workers/base.py", line 1092, in _get_configuration | else await self._client.read_deployment(flow_run.deployment_id) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/prefect/client/orchestration/_deployments/client.py", line 772, in read_deployment | raise ObjectNotFound(http_exc=e) from e | prefect.exceptions.ObjectNotFound: None | | During handling of the above exception, another exception occurred: | | Traceback (most recent call last): | File "/usr/local/lib/python3.11/site-packages/prefect/workers/process.py", line 448, in cancel_run | await self._mark_flow_run_as_cancelled( | File "/usr/local/lib/python3.11/site-packages/prefect/workers/base.py", line 1193, in _mark_flow_run_as_cancelled | await self._client.set_flow_run_state(flow_run.id, state, force=True) | File "/usr/local/lib/python3.11/site-packages/prefect/client/orchestration/_flow_runs/client.py", line 774, in set_flow_run_state | state=state_create.model_dump(mode="json", serialize_as_any=True), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 426, in model_dump | return self.__pydantic_serializer__.to_python( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | TypeError: 'MockValSer' object cannot be converted to 'SchemaSerializer' +------------------------------------ An exception occurred.
m
thought for 356.3 seconds
Thanks for the stack trace — there are two separate things going on here: 1) 404 “Deployment not found” - Your worker is trying to cancel a flow run and first attempts to read its deployment to run on_cancellation hooks. The API returns 404 for that deployment ID, which usually means: - The deployment was deleted after the run was scheduled, or - The worker is pointed at a different server/database than where the run was created (API URL/env mismatch). - Quick checks: - Inspect the flow run to confirm the `deployment_id`:
Copy code
prefect flow-run inspect <FLOW_RUN_ID>
- See if the deployment still exists:
Copy code
prefect deployment ls
- Ensure your worker’s
PREFECT_API_URL
points to the same server as where the run was created (and that it’s reachable). Example:
<http://prefect-server>
should resolve from the worker container/host. 2) TypeError: 'MockValSer' cannot be converted to 'SchemaSerializer' - This occurs while Prefect is trying to mark the run as cancelled and serialize the state (Pydantic 2.x serializer interaction). It’s a known issue that shows up during cancellation and in a few concurrency patterns. - Related issues you can follow: - Serialization error on canceling a flow run (ProcessPoolExecutor) - Intermittent errors with container flows; includes the same MockValSer trace - Dask task-from-task; same MockValSer pattern Recommended next steps - Upgrade Prefect everywhere (server and all workers) to the latest 3.x. We’ve made a number of fixes around cancellation and client behavior recently: - Latest release notes: Prefect 3.4.13 release - If you’re using Docker, use the matching tag for both server and workers. If using pip:
Copy code
pip install -U "prefect>=3.4.13"
- Ensure you’re not deleting deployments while runs from them are still active. If you need to decommission, let currently scheduled runs finish first. - If a run is stuck “Canceling”, you can clean it up:
Copy code
prefect flow-run delete <FLOW_RUN_ID>
- If the 404 persists: - Confirm the worker and UI/CLI are connected to the same API (same base URL and database). - Re-create the deployment and re-run (note: the old UUID won’t match, but this will prevent new runs from failing in the same way). Could you share: - Prefect version for server and worker - Worker type (process/docker/kubernetes/etc.) - Your
PREFECT_API_URL
value (or how workers are discovering the API) - Whether the deployment was recently deleted or renamed With that info, I can give more precise guidance or help tie your case to one of the GitHub issues above.