https://prefect.io logo
Title
j

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
MissingResult
exceptions on the initial flow run:
Encountered exception during execution:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/prefect/engine.py", line 624, in orchestrate_flow_run
    result = await run_sync(flow_call)
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/asyncutils.py", 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/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/.../insert_data.py", 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/tasks.py", line 367, in __call__
    return enter_task_run_engine(
  File "/usr/local/lib/python3.10/dist-packages/prefect/engine.py", 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/asyncutils.py", line 152, in run_async_from_worker_thread
    return anyio.from_thread.run(call)
  File "/usr/local/lib/python3.10/dist-packages/anyio/from_thread.py", line 49, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 970, in run_async_from_thread
    return f.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/dist-packages/prefect/engine.py", line 965, in get_task_call_return_value
    return await future._result()
  File "/usr/local/lib/python3.10/dist-packages/prefect/futures.py", 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/states.py", 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
c

Christopher Boyd

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

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: https://github.com/PrefectHQ/prefect/issues/8415