<@ULVA73B9P> what is this issue about? 2:01:06.133...
# ask-marvin
o
@Marvin what is this issue about? 120106.133 | INFO | Task run 'process_kernel-cc6' - Finished in state Completed() 120106.135 | INFO | Task run 'process_kernel-4f6' - Finished in state Completed() All kernels processed 120106.170 | ERROR | Flow run 'rebel-ibis' - Encountered exception during execution: TypeError("DoneAndNotDoneFutures.__new__() missing 1 required positional argument: 'not_done'") Traceback (most recent call last): File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 781, in run_context yield self File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 1395, in run_flow_sync engine.call_flow_fn() ~~~~~~~~~~~~~~~~~~~^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 802, in call_flow_fn self.handle_success(result) ~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 376, in handle_success resolved_result = resolve_futures_to_states(result) File "/home/labor/.local/lib/python3.13/site-packages/prefect/futures.py", line 656, in resolve_futures_to_states return _resolve_futures( expr, resolve_fn=_resolve_state, ) File "/home/labor/.local/lib/python3.13/site-packages/prefect/futures.py", line 714, in _resolve_futures return visit_collection( expr, ...<2 lines>... context={}, ) File "/home/labor/.local/lib/python3.13/site-packages/prefect/utilities/collections.py", line 484, in visit_collection result = type(seq)(items) TypeError: DoneAndNotDoneFutures.__new__() missing 1 required positional argument: 'not_done' 120106.329 | INFO | Flow run 'rebel-ibis' - Finished in state Failed("Flow run encountered an exception: TypeError: DoneAndNotDoneFutures.__new__() missing 1 required positional argument: 'not_done'") Traceback (most recent call last): File "/uvd-workflow-orchestrator-example-prefect/dev/dev_fan_in_fan_out.py", line 31, in <module> cluster_image_and_process(img) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flows.py", line 1702, in call return run_flow( flow=self, ...<2 lines>... return_type=return_type, ) File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 1552, in run_flow ret_val = run_flow_sync(**kwargs) File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 1397, in run_flow_sync return engine.state if return_type == "state" else engine.result() ~~~~~~~~~~~~~^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 361, in result raise self._raised File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 781, in run_context yield self File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 1395, in run_flow_sync engine.call_flow_fn() ~~~~~~~~~~~~~~~~~~~^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 802, in call_flow_fn self.handle_success(result) ~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/home/labor/.local/lib/python3.13/site-packages/prefect/flow_engine.py", line 376, in handle_success resolved_result = resolve_futures_to_states(result) File "/home/labor/.local/lib/python3.13/site-packages/prefect/futures.py", line 656, in resolve_futures_to_states return _resolve_futures( expr, resolve_fn=_resolve_state, ) File "/home/labor/.local/lib/python3.13/site-packages/prefect/futures.py", line 714, in _resolve_futures return visit_collection( expr, ...<2 lines>... context={}, ) File "/home/labor/.local/lib/python3.13/site-packages/prefect/utilities/collections.py", line 484, in visit_collection result = type(seq)(items) TypeError: DoneAndNotDoneFutures.__new__() missing 1 required positional argument: 'not_done'
m
thought for 191.3 seconds
Short version: your flow is returning a DoneAndNotDoneFutures object (from a wait/as_completed call), and Prefect’s result resolver is trying to “rebuild” that return value but calls its constructor incorrectly. That named-tuple-like type requires two positional args (
done
,
not_done
), and the resolver passes a single iterable instead—hence the TypeError. Why it happens: - After your tasks finish, Prefect tries to resolve the flow’s return value into final states. - If the return value is a DoneAndNotDoneFutures (from either
concurrent.futures.wait
or
prefect.futures.wait
), Prefect’s collection visitor reconstructs it with
type(seq)(items)
instead of unpacking it as two args, which causes: TypeError: DoneAndNotDoneFutures.__new__() missing 1 required positional argument: 'not_done' What to do now (workarounds): - Don’t return the DoneAndNotDoneFutures object directly. Return a plain tuple or dict instead. For example, if you’re using Prefect 3.x:
Copy code
from prefect.futures import wait

  done, not_done = wait(futures, return_when="ALL_COMPLETED")
  # Option 1: just return the finished items
  return list(done)

  # Option 2: return a simple structure
  return {"done": list(done), "not_done": list(not_done)}
If you’re using
concurrent.futures.wait
, do the same shape conversion:
Copy code
from concurrent.futures import wait, ALL_COMPLETED

  done, not_done = wait(futures, return_when=ALL_COMPLETED)
  return {"done": list(done), "not_done": list(not_done)}
A couple of checks: - You appear to be on Python 3.13 (
/site-packages/.../python3.13/
). Prefect 3.x hasn’t officially supported 3.13 yet. If possible, try Python 3.10–3.12 and the latest Prefect 3.x release. - Make sure you’re on the latest Prefect; there have been updates around futures and
wait
(Prefect futures API, source). If you can share: - The exact line you return from the flow (especially if it’s the output of `wait`/`as_completed`) - Your Prefect and Python versions …I can confirm whether this is a pure return-shape issue or a bug specific to your version/environment. If it reproduces on the latest Prefect with Python 3.12, I’m happy to file a bug upstream.