invoke-ai/InvokeAI · error · ValueError

The selected saved workflow '${self.workflow_id}' could not

Error message

The selected saved workflow '${self.workflow_id}' could not be found.

What it means

The node's workflow_id is set, but no record with that ID exists in the workflow records service. validate_selected_workflow catches WorkflowNotFoundError from workflow_records.get() and re-raises as a ValueError naming the missing ID.

Source

Thrown at invokeai/app/invocations/call_saved_workflow.py:58

    workflow_id: str = InputField(
        default="",
        description="The selected saved workflow ID, managed by the workflow editor UI.",
        ui_type=UIType.SavedWorkflow,
    )
    workflow_inputs: dict[str, Any] = InputField(
        default={},
        description="Literal values for the selected workflow's exposed inputs, managed by the workflow editor UI.",
        ui_hidden=True,
    )

    def validate_selected_workflow(self, context: InvocationContext):
        if not self.workflow_id:
            raise ValueError("A saved workflow must be selected before executing call_saved_workflow.")

        try:
            workflow_record = context._services.workflow_records.get(self.workflow_id)
        except WorkflowNotFoundError as e:
            raise ValueError(f"The selected saved workflow '{self.workflow_id}' could not be found.") from e

        config = context._services.configuration
        if config.multiuser:
            queue_user_id = context._data.queue_item.user_id
            user = context._services.users.get(queue_user_id)
            is_admin = bool(user and user.is_admin)
            is_owner = workflow_record.user_id == queue_user_id
            is_default = workflow_record.workflow.meta.category is WorkflowCategory.Default
            if not (is_default or is_owner or workflow_record.is_public or is_admin):
                raise ValueError(f"The selected saved workflow '{self.workflow_id}' is not accessible to this user.")

        return workflow_record

    def invoke(self, context: InvocationContext) -> WorkflowReturnOutput:
        self.validate_selected_workflow(context)

        return WorkflowReturnOutput(values={})

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Verify the workflow exists: list saved workflows and use the correct ID in workflow_id.
  2. Re-save or re-create the workflow if it was deleted, then point the node at the new ID.
  3. Re-open the graph in the editor and re-select the workflow to refresh the stale ID.

Example fix

// before
node.workflow_id = "8f2c..."  # deleted workflow
// after
records = context._services.workflow_records.list_all()
node.workflow_id = next(w.workflow_id for w in records if w.workflow.name == "My Workflow")
Defensive patterns

Strategy: validation

Validate before calling

from invokeai.app.services.workflow_records import WorkflowNotFoundError
try:
    context._services.workflow_records.get(node.workflow_id)
except WorkflowNotFoundError:
    print(f"workflow {node.workflow_id} missing; re-select")

Try / catch

try:
    node.invoke(context)
except ValueError as e:
    if "could not be found" in str(e):
        refresh_workflow_list_and_reselect()
    else:
        raise

Prevention

When it happens

Trigger: Calling invoke()/run_node() with a CallSavedWorkflow whose workflow_id points to a workflow that has been deleted, never existed, or whose ID was mistyped.

Common situations: Renaming/deleting saved workflows while graphs still reference old IDs; hardcoding workflow IDs copied from another InvokeAI instance or database; stale graph JSON exported before a workflow was removed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/c9062b491548afd8. Report an issue: GitHub.