{"record":{"id":"7a1514c95cc1a915","repo":"invoke-ai/InvokeAI","slug":"a-saved-workflow-must-be-selected-before-executing","errorCode":null,"errorMessage":"A saved workflow must be selected before executing call_saved_workflow.","messagePattern":"A saved workflow must be selected before executing call_saved_workflow\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/call_saved_workflow.py","lineNumber":53,"sourceCode":"    classification=Classification.Beta,\n)\nclass CallSavedWorkflowInvocation(BaseInvocation):\n    \"\"\"Displays and later executes against a selected saved workflow.\"\"\"\n\n    workflow_id: str = InputField(\n        default=\"\",\n        description=\"The selected saved workflow ID, managed by the workflow editor UI.\",\n        ui_type=UIType.SavedWorkflow,\n    )\n    workflow_inputs: dict[str, Any] = InputField(\n        default={},\n        description=\"Literal values for the selected workflow's exposed inputs, managed by the workflow editor UI.\",\n        ui_hidden=True,\n    )\n\n    def validate_selected_workflow(self, context: InvocationContext):\n        if not self.workflow_id:\n            raise ValueError(\"A saved workflow must be selected before executing call_saved_workflow.\")\n\n        try:\n            workflow_record = context._services.workflow_records.get(self.workflow_id)\n        except WorkflowNotFoundError as e:\n            raise ValueError(f\"The selected saved workflow '{self.workflow_id}' could not be found.\") from e\n\n        config = context._services.configuration\n        if config.multiuser:\n            queue_user_id = context._data.queue_item.user_id\n            user = context._services.users.get(queue_user_id)\n            is_admin = bool(user and user.is_admin)\n            is_owner = workflow_record.user_id == queue_user_id\n            is_default = workflow_record.workflow.meta.category is WorkflowCategory.Default\n            if not (is_default or is_owner or workflow_record.is_public or is_admin):\n                raise ValueError(f\"The selected saved workflow '{self.workflow_id}' is not accessible to this user.\")\n\n        return workflow_record\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/call_saved_workflow.py#L35-L71","documentation":"call_saved_workflow refuses to run when no workflow_id is set. The node requires a workflow that has been saved to the workflow records service; validate_selected_workflow checks this before anything else and raises ValueError immediately if the field is empty/None.","triggerScenarios":"Invoking a CallSavedWorkflow invocation (directly via invoke() or through run_node) while self.workflow_id is empty string or None — e.g. the node was added to a graph but the user never picked a workflow in the editor, or the field was programmatically left at its default.","commonSituations":"Building graphs via API/script where the workflow_id field was never populated; UI workflows where the user forgot to select a saved workflow; importing a graph that references a node whose workflow_id was never persisted.","solutions":["Select a saved workflow for the node (set workflow_id to the saved workflow's ID) before executing.","Programmatically set workflow_id on the CallSavedWorkflow node before queueing the graph.","Add a pre-flight check on the graph to ensure every call_saved_workflow node has a non-empty workflow_id."],"exampleFix":"// before\nnode = CallSavedWorkflow()  # workflow_id not set\ngraph.add_node(node)\n// after\nnode = CallSavedWorkflow(workflow_id=\"saved-workflow-uuid\")\ngraph.add_node(node)","handlingStrategy":"validation","validationCode":"if not node.workflow_id:\n    raise ValueError(\"select a saved workflow before executing\")","typeGuard":null,"tryCatchPattern":"try:\n    output = node.invoke(context)\nexcept ValueError as e:\n    if \"must be selected\" in str(e):\n        prompt_user_to_select_workflow()\n    else:\n        raise","preventionTips":["Always set workflow_id when constructing CallSavedWorkflow nodes programmatically","Validate graphs for empty required fields before queueing","Re-select workflows in the UI after editing imported graphs"],"tags":["validation","workflow","invokeai"],"backgroundTag":"missing-required-field","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}