invoke-ai/InvokeAI · error · ValueError

The selected system prompt '{system_prompt_id}' could not be

Error message

The selected system prompt '{system_prompt_id}' could not be found.

What it means

_resolve_system_prompt looks up the requested system prompt id via context._services.system_prompt_records.get(). When the record does not exist (SystemPromptNotFoundError), it re-raises as a ValueError with the offending id so users get a clear graph-execution error.

Source

Thrown at invokeai/app/invocations/text_llm.py:156

        The record store is unscoped, so without this check a user could read another user's
        private prompt by enqueueing a graph that references its id -- the content becomes the
        LLM's system message and is recoverable from the node's output.

        The rule is deliberately identical to `routers/system_prompts.get_system_prompt`: owner,
        public, or admin. Note there is no "owned by the 'system' user" clause, even though the
        seeded defaults are owned by it -- `SYSTEM_PROMPT_DEFAULT_USER_ID` is also the synthetic
        id every request carries in single-user mode (`auth_dependencies.get_current_user`), so
        such a clause would make every prompt created before an install switched to multiuser
        un-privatizable here while the REST layer still 403s on it. The seeded defaults are
        `is_public=TRUE`, so `record.is_public` already covers them.
        (`call_saved_workflow` can keep its default-category clause: workflow `category=default`
        is a real column value, not an overloaded owner id.)
        """
        system_prompt_id = self.system_prompt.system_prompt_id
        try:
            record = context._services.system_prompt_records.get(system_prompt_id)
        except SystemPromptNotFoundError as e:
            raise ValueError(f"The selected system prompt '{system_prompt_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 = record.user_id == queue_user_id
            if not (is_owner or record.is_public or is_admin):
                raise ValueError(f"The selected system prompt '{system_prompt_id}' is not accessible to this user.")

        return record

    @torch.no_grad()
    def invoke(self, context: InvocationContext) -> StringOutput:
        record = self._resolve_system_prompt(context)
        output = _run_text_llm(
            context=context,
            text_llm_model=self.text_llm_model,

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Select an existing system prompt in the LLM node (or recreate the deleted one) and re-run.
  2. Export/import your system prompts (or restore the DB backup) so the referenced id exists.
  3. Inspect the workflow JSON's system_prompt_id and replace it with a valid id.
  4. On multiuser installs, have the prompt owner make it public or use an admin account.

Example fix

// before
system_prompt_id = "my-old-prompt"  # deleted
// after
system_prompt_id = context._services.system_prompt_records.get_default_id()
Defensive patterns

Strategy: validation

Validate before calling

try:
    context._services.system_prompt_records.get(node.system_prompt.system_prompt_id)
except SystemPromptNotFoundError:
    node.system_prompt.system_prompt_id = default_prompt_id()

Type guard

def prompt_exists(services, prompt_id: str) -> bool:
    try:
        services.system_prompt_records.get(prompt_id)
        return True
    except SystemPromptNotFoundError:
        return False

Try / catch

try:
    result = invoke(context)
except ValueError as e:
    if "could not be found" in str(e) and "system prompt" in str(e):
        remap_system_prompt_id(graph, fallback_prompt_id())
        retry(context)
    else:
        raise

Prevention

When it happens

Trigger: The LLM node's system_prompt.system_prompt_id references a prompt that was deleted, belongs to another user's private set, or was carried over from a different database via an imported workflow.

Common situations: Deleting a system prompt still referenced by saved workflows; switching/migrating the app database; sharing workflow JSON between users with different prompt libraries; multiuser installs where a prompt id exists but isn't visible.

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/dcb913f4c34e948b. Report an issue: GitHub.