{"record":{"id":"dcb913f4c34e948b","repo":"invoke-ai/InvokeAI","slug":"the-selected-system-prompt-system-prompt-id-co","errorCode":null,"errorMessage":"The selected system prompt '{system_prompt_id}' could not be found.","messagePattern":"The selected system prompt '(.+?)' could not be found\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/text_llm.py","lineNumber":156,"sourceCode":"        The record store is unscoped, so without this check a user could read another user's\n        private prompt by enqueueing a graph that references its id -- the content becomes the\n        LLM's system message and is recoverable from the node's output.\n\n        The rule is deliberately identical to `routers/system_prompts.get_system_prompt`: owner,\n        public, or admin. Note there is no \"owned by the 'system' user\" clause, even though the\n        seeded defaults are owned by it -- `SYSTEM_PROMPT_DEFAULT_USER_ID` is also the synthetic\n        id every request carries in single-user mode (`auth_dependencies.get_current_user`), so\n        such a clause would make every prompt created before an install switched to multiuser\n        un-privatizable here while the REST layer still 403s on it. The seeded defaults are\n        `is_public=TRUE`, so `record.is_public` already covers them.\n        (`call_saved_workflow` can keep its default-category clause: workflow `category=default`\n        is a real column value, not an overloaded owner id.)\n        \"\"\"\n        system_prompt_id = self.system_prompt.system_prompt_id\n        try:\n            record = context._services.system_prompt_records.get(system_prompt_id)\n        except SystemPromptNotFoundError as e:\n            raise ValueError(f\"The selected system prompt '{system_prompt_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 = record.user_id == queue_user_id\n            if not (is_owner or record.is_public or is_admin):\n                raise ValueError(f\"The selected system prompt '{system_prompt_id}' is not accessible to this user.\")\n\n        return record\n\n    @torch.no_grad()\n    def invoke(self, context: InvocationContext) -> StringOutput:\n        record = self._resolve_system_prompt(context)\n        output = _run_text_llm(\n            context=context,\n            text_llm_model=self.text_llm_model,","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/text_llm.py#L138-L174","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Select an existing system prompt in the LLM node (or recreate the deleted one) and re-run.","Export/import your system prompts (or restore the DB backup) so the referenced id exists.","Inspect the workflow JSON's system_prompt_id and replace it with a valid id.","On multiuser installs, have the prompt owner make it public or use an admin account."],"exampleFix":"// before\nsystem_prompt_id = \"my-old-prompt\"  # deleted\n// after\nsystem_prompt_id = context._services.system_prompt_records.get_default_id()","handlingStrategy":"validation","validationCode":"try:\n    context._services.system_prompt_records.get(node.system_prompt.system_prompt_id)\nexcept SystemPromptNotFoundError:\n    node.system_prompt.system_prompt_id = default_prompt_id()","typeGuard":"def prompt_exists(services, prompt_id: str) -> bool:\n    try:\n        services.system_prompt_records.get(prompt_id)\n        return True\n    except SystemPromptNotFoundError:\n        return False","tryCatchPattern":"try:\n    result = invoke(context)\nexcept ValueError as e:\n    if \"could not be found\" in str(e) and \"system prompt\" in str(e):\n        remap_system_prompt_id(graph, fallback_prompt_id())\n        retry(context)\n    else:\n        raise","preventionTips":["Export system prompts before deleting them","Search workflows for stale prompt ids after DB migrations","On multiuser installs, share prompts by making them public"],"tags":["lookup","system-prompt","llm"],"backgroundTag":"resource-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}