{"record":{"id":"c95222e621896c8d","repo":"invoke-ai/InvokeAI","slug":"the-selected-saved-workflow-did-not-produce-a-vali","errorCode":null,"errorMessage":"The selected saved workflow did not produce a valid workflow_return output.","messagePattern":"The selected saved workflow did not produce a valid workflow_return output\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/session_processor/workflow_call_runtime.py","lineNumber":157,"sourceCode":"        workflow_return_node_ids = [\n            node_id for node_id, node in child_session.graph.nodes.items() if node.get_type() == \"workflow_return\"\n        ]\n        if not workflow_return_node_ids:\n            raise ValueError(\"The selected saved workflow must contain exactly one workflow_return node.\")\n        if len(workflow_return_node_ids) > 1:\n            raise ValueError(\"The selected saved workflow must not contain more than one workflow_return node.\")\n\n        workflow_return_node_id = workflow_return_node_ids[0]\n        prepared_return_node_ids = child_session.source_prepared_mapping.get(workflow_return_node_id, set())\n        if len(prepared_return_node_ids) != 1:\n            raise ValueError(\n                \"The selected saved workflow produced an unsupported number of workflow_return executions.\"\n            )\n\n        prepared_return_node_id = next(iter(prepared_return_node_ids))\n        output = child_session.results.get(prepared_return_node_id)\n        if not isinstance(output, WorkflowReturnOutput):\n            raise ValueError(\"The selected saved workflow did not produce a valid workflow_return output.\")\n\n        return output\n\n    def resume_waiting_workflow_call(self, queue_item: SessionQueueItem) -> None:\n        invocation = self.get_waiting_workflow_call_invocation(queue_item)\n        child_session = queue_item.session.waiting_workflow_call_child_session\n        if child_session is None:\n            raise ValueError(\"Execution state is waiting on a workflow call but has no attached child session.\")\n        output = self.get_child_workflow_return_output(child_session)\n        queue_item.session.end_waiting_on_workflow_call(status=\"completed\")\n        queue_item.session.complete(invocation.id, output)\n        self._session_runner._on_after_run_node(invocation, queue_item, output)\n\n    def fail_waiting_workflow_call(self, queue_item: SessionQueueItem, error_message: str) -> None:\n        invocation = self.get_waiting_workflow_call_invocation(queue_item)\n        queue_item.session.end_waiting_on_workflow_call(status=\"failed\", error_message=error_message)\n        self._session_runner._on_node_error(\n            invocation=invocation,","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/session_processor/workflow_call_runtime.py#L139-L175","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: assuming the child completed\noutput = get_child_workflow_return_output(child_session)\n// after: verify child completed first\nif child_session.is_complete:\n    output = get_child_workflow_return_output(child_session)","handlingStrategy":"validation","validationCode":"output = child_session.results.get(prepared_return_node_id)\nif output is None:\n    raise RuntimeError(\"Child workflow finished without a workflow_return result; check child run for failures/cancellation.\")","typeGuard":"from invokeai.app.invocations.output import WorkflowReturnOutput\n\ndef has_valid_return_output(session, prepared_return_node_id: str) -> bool:\n    return isinstance(session.results.get(prepared_return_node_id), WorkflowReturnOutput)","tryCatchPattern":"try:\n    output = runtime.get_child_workflow_return_output(child_session)\nexcept ValueError as e:\n    logger.warning(\"Child workflow_return missing/invalid: %s\", e)\n    # inspect child_session logs, then re-run the child workflow","preventionTips":["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"],"tags":["workflow","session","runtime"],"backgroundTag":"workflow-return-output-missing","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}