John-Craig Borman

02/01/2023, 6:44 PM
Possibly a bug - I've noticed that a few flow runs out of ~200 are inconsistently failing due to
exceptions on the initial flow run:
Encountered exception during execution:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 624, in orchestrate_flow_run
    result = await run_sync(flow_call)
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/", line 69, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/usr/local/lib/python3.10/dist-packages/anyio/", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/", line 867, in run
    result =, *args)
  File "/.../", line 246, in insert_data
    if is_typing_flow(vendor_config, wait_for=[copy_file_result]):
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 367, in __call__
    return enter_task_run_engine(
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 824, in enter_task_run_engine
    return run_async_from_worker_thread(begin_run)
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/", line 152, in run_async_from_worker_thread
  File "/usr/local/lib/python3.10/dist-packages/anyio/", line 49, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/", line 970, in run_async_from_thread
    return f.result()
  File "/usr/lib/python3.10/concurrent/futures/", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 965, in get_task_call_return_value
    return await future._result()
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 237, in _result
    return await final_state.result(raise_on_failure=raise_on_failure, fetch=True)
  File "/usr/local/lib/python3.10/dist-packages/prefect/", line 89, in _get_state_result
    raise MissingResult(
prefect.exceptions.MissingResult: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
The error would make sense if the flow run failed after triggering a retry (as we have result persistence disabled), but to reemphasize it is occurring on the initial flow run

Christopher Boyd

02/02/2023, 2:22 PM
Hi John, We have an open issue on this behavior that is being investigated:
If you’d like to add your experience and feedback to the thread, that would be helpful in diagnosing the issue

John-Craig Borman

02/02/2023, 2:23 PM
Sure thing, thanks @Christopher Boyd!
Hey @Christopher Boyd I was able to isolate the bug and created a new issue with a MWE: