Client error '409 Conflict' Error On Windows Server

Hi,

I’m using Prefect (version 2.14.5) on a Windows Server, and I’ve encountered an unusual error that occurs sporadically across various deployments, flows, and tasks.

For instance, there are times when I get successfully 30 scheduled flow runs without encountering any errors. However, suddenly, I encounter the following error in a specific task. Similarly, I may experience about 50 error-free flow runs, only to encounter the same error in an entirely different flow and task. I’m having difficulty understanding the root cause of this issue. I hope you can provide some assistance.

The error I get is as follows:

File "C:\Prefect_Instance\prefect_virtual_env\Lib\site-packages\prefect\client\base.py", line 164, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '409 Conflict' for url 'http://myserverip:4200/api/task_runs/0c2a0e42-932d-44be-b20a-99650d7ebc34/set_state'
Response: {'detail': 'Data integrity conflict. This usually means a unique or foreign key constraint was violated. See server logs for details.'}
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/40

Note: I was running prefect==2.10.2 on a different server in the same network, I did not encounter this error.

Hi!

We have the same problem. In version 2.13… there was no such problem.
But at first, after upgrading to version 2.14.5, everything was fine. It was only after several restarts of the server and the worker that the problem (409 Conflict) started.
To temporarily solve the problem, we have removed the @task decorators.

@kaan @many Did either of you find a resolution to this? We recently updated to v2.19.1 and are suddenly getting tons of these errors. I don’t think removing our @task decorators is a viable solution.

I resolved this by setting the Prefect API URL…

prefect config set PREFECT_API_URL="http://127.0.0.1:4200/api"