Madushan Pathirana
07/21/2026, 3:08 PMMarvin
07/21/2026, 3:08 PMMarvin
07/21/2026, 3:10 PM409 Conflict on POST /api/deployments/{id}/create_flow_run in Prefect 3.x usually means the server rejected the run creation because something conflicted with deployment state, parameter validation, or database integrity.
The most likely causes are:
1. Parameter schema validation failed
If your deployment has parameter schema enforcement enabled, the parameters sent from Lambda must match the deployment’s schema exactly.
Typical examples:
- missing required parameters
- wrong types
- unexpected structure
Prefect returns 409 for this case with a message like:
text
Error creating flow run: ...
2. Schema enforcement is enabled, but the deployment has no valid schema
If enforce_parameter_schema=True on the deployment, but the deployment’s stored schema is invalid or missing, Prefect can also return 409.
3. Database integrity conflict
Prefect also maps DB integrity errors to 409. That usually means:
- a foreign key / unique constraint issue
- a race condition
- duplicate creation behavior under concurrent Lambda invocations
The generic message for this case is:
text
Data integrity conflict. This usually means a unique or foreign key constraint was violated. See server logs for details.
4. In some newer versions: deployment is disabled
A disabled deployment can also lead to a 409 when trying to create a flow run.
What to check first
Check your Prefect server logs
The traceback you pasted only shows the client-side HTTP error. The real reason should be in the Prefect API server logs.
Check the deployment definition
Inspect:
- whether parameter schema enforcement is on
- whether the parameters you send from Lambda match expected names/types
- whether the deployment is enabled
You can query the deployment directly:
text
GET /api/deployments/{id}
Look for fields related to:
- enforce_parameter_schema
- parameter_openapi_schema
- deployment status / enabled state
Validate the Lambda payload
Make sure the body you send to create_flow_run looks like valid Prefect input, e.g.:
json
{
"parameters": {
"x": 1,
"y": "abc"
}
}
If you’re sending custom JSON, double-check:
- parameter names match the flow function signature
- values are JSON-serializable
- types match the deployment schema
If Lambda may retry, use an idempotency key
If multiple invocations can submit the same request, include `idempotency_key`:
json
{
"parameters": {
"x": 1
},
"idempotency_key": "some-unique-request-id"
}
That helps avoid duplicate/conflicting run creation patterns.
Most likely in your case
Because you’re calling the API directly from Lambda, the first thing I’d suspect is parameter schema mismatch or a retry/concurrency-related conflict.
If you want, paste:
- the JSON body you send to create_flow_run
- the deployment’s parameter schema / flow signature
- the relevant Prefect API server log line for that request
and I can help pinpoint the exact cause.
Relevant docs:
- Prefect deployments
- Create flow run from deployment API
- Deployment concepts