<@ULVA73B9P> I am seeing all the flow runs crash w...
# ask-marvin
p
@Marvin I am seeing all the flow runs crash with the events tab showing the flow runs as deleted. The actual error logs display this error as follows -
Copy code
File "/usr/local/lib/python3.12/site-packages/prefect/flows.py", line 1871, in load_flow_from_flow_run
deployment = await client.read_deployment(flow_run.deployment_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/client/orchestration.py", line 1793, in read_deployment
return DeploymentResponse.model_validate(response.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 596, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for DeploymentResponse
UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Python version in use is python3.12
m
thought for 755.7 seconds
Thanks for the traceback — that’s helpful. What your logs show is the engine trying to load the flow code from the deployment, then failing when it calls
client.read_deployment(...)
because a UUID field in the returned deployment payload is
None
. In Pydantic v2 (used by Prefect 3.x), UUIDs can’t be
None
, so you see:
Copy code
ValidationError: DeploymentResponse
UUID input should be a string, bytes or UUID object [input=None]
Most common causes - The flow run has no deployment_id (ad‑hoc run/subflow) and the engine still tries to load a deployment. - Client ↔️ server version mismatch (especially if you’re self‑hosting). A server returning a schema where a field the client expects as a UUID is null will trigger exactly this error. - A partially/mis‑migrated deployment record (e.g., after an upgrade) where a required UUID field is null. Python 3.12 itself is supported and not the root cause. Quick checks to pinpoint the issue 1) Confirm the flow run has a deployment_id - Grab a failing run id and run:
Copy code
prefect flow-run inspect <flow_run_id>
If
deployment_id
is null, that run was created without a deployment. 2) Inspect the deployment object - If you know the deployment name:
Copy code
prefect deployment inspect "<flow_name>/<deployment_name>"
Verify that UUID fields (e.g.,
id
,
flow_id
, etc.) are present and not null. 3) Verify versions on your worker(s) and your server - On the worker/where runs execute:
Copy code
prefect version
- If you’re self‑hosting, confirm the server image/tag and that DB migrations have been applied:
Copy code
prefect server database upgrade
Likely fixes based on what you find - If deployment_id is None: - Make sure runs are created from a deployment (UI “Run” on the deployment,
prefect deployment run
, or programmatically via
flow.from_source(...).deploy(...))
. Ad‑hoc runs/subflows don’t have a deployment to load. - Avoid calling flows directly in production without deployments. - If you’re self‑hosting and versions are out of sync: - Align your client(s) and server to compatible 3.x versions and run DB migrations. In practice, upgrading to the latest 3.x on both sides usually resolves schema mismatches. - After upgrading the server, run:
Copy code
prefect server database upgrade
- If the deployment object looks “incomplete” (a UUID field is null): - Recreate the deployment (either via
prefect deploy
or programmatically using
flow.from_source(...).deploy(...)
) to regenerate a clean record. Helpful docs - Prefect Server and version compatibility - Flow loading (load_flow_from_flow_run) Can you share: - Are you using Prefect Cloud or self‑hosted Server? - The output of
prefect version
from the worker environment - One affected flow_run_id, and the output of: -
prefect flow-run inspect <flow_run_id>
- If applicable,
prefect deployment inspect "<flow>/<deployment>"
With that, I can point you to the exact fix. If you prefer, we can also turn on more logging by setting
PREFECT_LOGGING_LEVEL=DEBUG
on the worker and capturing the startup logs for a failing run.
p
I am using prefect cloud & the deployment is served via flow.serve(name=<flow-name>).
@Marvin
n
hi @Parth Vyas what version of the prefect library are you using?
p
It is
3.4.1
on the server. I am triggering flow runs via the HTTP API.
<base path>/deployments/<deploymen Id>/create_flow_run
@Nate
@Nate I am also seeing the flow being redeployed every time a flow run is registered for the deployment.
n
this is almost certainly a mismatch in
prefect
versions between your server and client if your server is on
3.4.1
, is your client on a newer version?