Client error '404 Not Found' when running trying to start a deployment from docker

So I’ve been following the tutorial here: Docker - Prefect Docs

However when I try to run the deployment, I get a httpx.HTTPStatusError: Client error '404 Not Found'

Deployment command:

prefect deployment build ./ -n log-flow-docker-tutorial -ib docker-container/log-tutorial -q test -o log-flow-docker-deployment.yaml -a


17:30:38.678 | INFO    | prefect.agent - Submitting flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221'
17:30:38.782 | INFO    | prefect.infrastructure.docker-container - Creating Docker container 'epsilon64-kanki'...
17:30:38.935 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'created'
17:30:39.418 | DEBUG   | prefect.agent - Checking for cancelled flow runs...
17:30:39.489 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'running'
17:30:39.494 | INFO    | prefect.agent - Completed submission of flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221'
/usr/local/lib/python3.10/ RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
06:30:45.453 | DEBUG   | prefect.client - Using ephemeral application with database at sqlite+aiosqlite:////root/.prefect/orion.db
06:30:45.480 | ERROR   | prefect.engine - Engine execution of flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221' exited with unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 1443, in read_flow_run
    response = await self._client.get(f"/flow_runs/{flow_run_id}")
  File "/usr/local/lib/python3.10/site-packages/httpx/", line 1757, in get
    return await self.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 251, in send
  File "/usr/local/lib/python3.10/site-packages/httpx/", line 745, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://ephemeral-orion/api/flow_runs/ef1e3069-e611-4dda-ad54-11c0ba4af221'
For more information check:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 1785, in <module>
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 186, in enter_flow_run_engine_from_subprocess
    return, flow_run_id)
  File "/usr/local/lib/python3.10/site-packages/anyio/_core/", line 70, in run
    return, *args, **backend_options)
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/local/lib/python3.10/asyncio/", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/", line 287, in wrapper
    return await func(*args)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 47, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 258, in retrieve_flow_then_begin_flow_run
    flow_run = await client.read_flow_run(flow_run_id)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 1446, in read_flow_run
    raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
17:30:46.182 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'exited'
17:30:46.183 | INFO    | prefect.infrastructure.docker-container - Docker container 'epsilon64-kanki' has status 'exited'
17:30:46.201 | INFO    | prefect.agent - Reported flow run 'ef1e3069-e611-4dda-ad54-11c0ba4af221' as crashed: Flow run infrastructure exited with non-zero status code 1.

I dont think it’s a problem with my code, and everything else is pretty basic. The deployment also works if I exclude the docker block from the deployment command (no --ib docker-container/log-tutorial). Why is this happening?

looks like the flow run was deleted

I would need a full reproducible example - can you perhaps build a full small repo with all files and share it? we could try to reproduce then

Here’s my repo: GitHub - Wingmore/prefect-docker-tutorial: Prefect docker tutorial

If it’s any help, my environment details are
conda 4.11.0
prefect 2.7.0
Python 3.10.8

thanks so much - did you set your Prefect Cloud API key? this would explain 404

I think the issue is that you are using a recipe for Prefect Cloud and you try to run it for OSS with ephemeral API: httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://ephemeral-orion/api/flow_runs/ef1e3069-e611-4dda-ad54-11c0ba4af221'

for OSS, I’d recommend following this setup:

No, I was using Prefect Orion the whole time using prefect orion start… Are there instructions on how to set up this key?

Also what is OSS?

OSS means open source, sorry

API key can be created when you sign up for prefect cloud, check our documentation in section Cloud