invoke-ai/InvokeAI · error · ValueError
The selected saved workflow must not contain more than one w
Error message
The selected saved workflow must not contain more than one workflow_return node.
What it means
When a workflow-call node executes a saved child workflow, InvokeAI requires exactly one workflow_return node in that child graph so the parent knows which node's output to hand back. This ValueError is raised in get_child_workflow_return_output when the child graph contains more than one workflow_return node, making the return value ambiguous.
Source
Thrown at invokeai/app/services/session_processor/workflow_call_runtime.py:145
@staticmethod
def get_waiting_workflow_call_invocation(queue_item: SessionQueueItem) -> CallSavedWorkflowInvocation:
waiting_frame = queue_item.session.waiting_workflow_call
if waiting_frame is None:
raise ValueError("Execution state is not waiting on a workflow call.")
invocation = queue_item.session.execution_graph.nodes.get(waiting_frame.prepared_call_node_id)
if not isinstance(invocation, CallSavedWorkflowInvocation):
raise ValueError("Waiting workflow call frame does not point to a call_saved_workflow invocation.")
return invocation
@staticmethod
def get_child_workflow_return_output(child_session: GraphExecutionState) -> WorkflowReturnOutput:
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_sessionView on GitHub (pinned to 0b6a024f2f)
Solutions
- Open the saved child workflow in the editor and delete the extra workflow_return node(s), leaving exactly one
- Inspect the workflow JSON (graph.nodes) and remove all but one node whose type is workflow_return
- Re-save the workflow and re-run the parent workflow
- If the workflow was duplicated programmatically, fix the duplication logic to strip duplicate return nodes
Example fix
// before: graph with two workflow_return nodes
{"nodes": {"a": {"type": "workflow_return", ...}, "b": {"type": "workflow_return", ...}}}
// after: keep exactly one
{"nodes": {"a": {"type": "workflow_return", ...}}} Defensive patterns
Strategy: validation
Validate before calling
return_ids = [nid for nid, n in workflow.graph.nodes.items() if n.get_type() == 'workflow_return']
if len(return_ids) != 1:
raise ValueError(f"Saved workflow must contain exactly one workflow_return node (found {len(return_ids)}).") Type guard
def has_single_return(graph) -> bool:
return sum(1 for n in graph.nodes.values() if n.get_type() == "workflow_return") == 1 Try / catch
try:
output = runtime.get_child_workflow_return_output(child_session)
except ValueError as e:
logger.error(f"Child workflow misconfigured: {e}")
# fix the workflow, then re-run Prevention
- After editing or duplicating a workflow, count workflow_return nodes before saving
- Keep workflow_return addition confined to the workflow editor's dedicated action
- Add a save-time lint that rejects graphs with != 1 workflow_return node
- Review merged workflow JSON for duplicated return nodes
When it happens
Trigger: Calling a child workflow via a workflow_call invocation whose saved graph was edited (or duplicated) to include two or more workflow_return nodes; the error surfaces when the parent resumes from the completed/waiting child session (resume_waiting_workflow_call or _resume_parent_from_completed_child).
Common situations: Duplicating a workflow that already had a workflow_return node, manually editing a saved workflow JSON, or merging two workflows without removing one of the return nodes.
Related errors
- A saved workflow must be selected before executing call_save
- The selected saved workflow '${self.workflow_id}' could not
- Workflow return key must not be empty.
- Duplicate workflow return key '{key}'.
- Workflow return key '{key}' was not found.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/eedc2fb7b0618328.
Report an issue: GitHub.