invoke-ai/InvokeAI · error · ValueError
The selected saved workflow did not produce a valid workflow
Error message
The selected saved workflow did not produce a valid workflow_return output.
What it means
Once the single prepared workflow_return execution is located, its result is fetched from child_session.results and must be an instance of WorkflowReturnOutput. This ValueError is raised when the result is missing or of an unexpected type, so the parent cannot receive a valid return value from the child workflow.
Source
Thrown at invokeai/app/services/session_processor/workflow_call_runtime.py:157
workflow_return_node_ids = [
node_id for node_id, node in child_session.graph.nodes.items() if node.get_type() == "workflow_return"
]
if not workflow_return_node_ids:
raise ValueError("The selected saved workflow must contain exactly one workflow_return node.")
if len(workflow_return_node_ids) > 1:
raise ValueError("The selected saved workflow must not contain more than one workflow_return node.")
workflow_return_node_id = workflow_return_node_ids[0]
prepared_return_node_ids = child_session.source_prepared_mapping.get(workflow_return_node_id, set())
if len(prepared_return_node_ids) != 1:
raise ValueError(
"The selected saved workflow produced an unsupported number of workflow_return executions."
)
prepared_return_node_id = next(iter(prepared_return_node_ids))
output = child_session.results.get(prepared_return_node_id)
if not isinstance(output, WorkflowReturnOutput):
raise ValueError("The selected saved workflow did not produce a valid workflow_return output.")
return output
def resume_waiting_workflow_call(self, queue_item: SessionQueueItem) -> None:
invocation = self.get_waiting_workflow_call_invocation(queue_item)
child_session = queue_item.session.waiting_workflow_call_child_session
if child_session is None:
raise ValueError("Execution state is waiting on a workflow call but has no attached child session.")
output = self.get_child_workflow_return_output(child_session)
queue_item.session.end_waiting_on_workflow_call(status="completed")
queue_item.session.complete(invocation.id, output)
self._session_runner._on_after_run_node(invocation, queue_item, output)
def fail_waiting_workflow_call(self, queue_item: SessionQueueItem, error_message: str) -> None:
invocation = self.get_waiting_workflow_call_invocation(queue_item)
queue_item.session.end_waiting_on_workflow_call(status="failed", error_message=error_message)
self._session_runner._on_node_error(
invocation=invocation,View on GitHub (pinned to 0b6a024f2f)
Solutions
- Ensure the child workflow runs to completion and the workflow_return node actually executes
- Re-run / re-enqueue the workflow so results are regenerated
- Check child session logs for an earlier node failure that prevented the return node from running
- Upgrade InvokeAI if results were saved by an older version with a different output model
Example fix
// before: assuming the child completed
output = get_child_workflow_return_output(child_session)
// after: verify child completed first
if child_session.is_complete:
output = get_child_workflow_return_output(child_session) Defensive patterns
Strategy: validation
Validate before calling
output = child_session.results.get(prepared_return_node_id)
if output is None:
raise RuntimeError("Child workflow finished without a workflow_return result; check child run for failures/cancellation.") Type guard
from invokeai.app.invocations.output import WorkflowReturnOutput
def has_valid_return_output(session, prepared_return_node_id: str) -> bool:
return isinstance(session.results.get(prepared_return_node_id), WorkflowReturnOutput) Try / catch
try:
output = runtime.get_child_workflow_return_output(child_session)
except ValueError as e:
logger.warning("Child workflow_return missing/invalid: %s", e)
# inspect child_session logs, then re-run the child workflow Prevention
- Never cancel/fail a child workflow before its workflow_return node executes
- Check child session status is complete before extracting return output
- Match InvokeAI versions between save and resume times (output schema stability)
- Monitor child session logs for upstream node failures
When it happens
Trigger: child_session.results.get(prepared_return_node_id) returns None (the return node never produced a result, e.g. the child was canceled or failed before the return node ran) or stores an object that is not WorkflowReturnOutput when the parent resumes.
Common situations: Canceling or failing the child workflow before the return node executes, resuming a partially executed child session, or version mismatches where stored results were serialized under a different output schema.
Related errors
- The selected saved workflow produced an unsupported number o
- Video workflow not found
- Workflow not found
- Not authorized to access this workflow
- '${field_name}' is not a call_saved_workflow dynamic input f
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/c95222e621896c8d.
Report an issue: GitHub.