{"record":{"id":"f1bcf08fd5958177","repo":"BerriAI/litellm","slug":"prompt-template-prompt-id-not-found","errorCode":null,"errorMessage":"Prompt template '{prompt_id}' not found","messagePattern":"Prompt template '(.+?)' not found","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/arize/arize_phoenix_prompt_manager.py","lineNumber":260,"sourceCode":"\n    def get_prompt_template(\n        self,\n        prompt_id: str,\n        prompt_variables: dict[str, Any] | None = None,\n    ) -> tuple[list[AllMessageValues], dict[str, Any]]:\n        \"\"\"\n        Get a prompt template and render it with variables.\n\n        Args:\n            prompt_id: The ID of the prompt version\n            prompt_variables: Variables to substitute in the template\n\n        Returns:\n            Tuple of (rendered_messages, metadata)\n        \"\"\"\n        template: Final = self.prompt_manager.get_template(prompt_id)\n        if not template:\n            raise ValueError(f\"Prompt template '{prompt_id}' not found\")\n\n        # Render the template\n        rendered_messages: Final = self.prompt_manager.render_template(prompt_id, prompt_variables or {})\n\n        # Extract metadata\n        metadata: Final = {\n            \"model\": template.model,\n            \"temperature\": template.temperature,\n            \"max_tokens\": template.max_tokens,\n        }\n\n        # Add additional invocation parameters\n        invocation_params: Final = template.invocation_parameters\n        provider_params = {}\n\n        if \"openai\" in invocation_params:\n            provider_params = invocation_params[\"openai\"]\n        elif \"anthropic\" in invocation_params:","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/arize/arize_phoenix_prompt_manager.py#L242-L278","documentation":"Raised by litellm's Arize Phoenix prompt integration when get_prompt_template() cannot find a template for the given prompt_id. The manager first calls get_template(prompt_id) on the underlying Phoenix prompt manager, and if that returns None or an empty value the lookup is treated as a failure. This almost always means the prompt does not exist in your Arize Phoenix instance (or was deleted/renamed) rather than a transient error.","triggerScenarios":"Calling completion with a prompt managed by Arize Phoenix (e.g. model='phoenix/<prompt_id>' or via prompt_id in litellm_params) where prompt_id has no corresponding prompt in Phoenix; the prompt failed to load from the Phoenix API earlier (network/auth failure silently left it out of prompt_manager.prompts); referencing a deleted prompt version.","commonSituations":"Typos in the prompt_id in the model string; prompt was deleted or renamed in the Phoenix UI after the integration was configured; Phoenix endpoint/API key misconfigured so the initial _load_prompt_from_arize never populated the cache; using a prompt_id from a different Phoenix project/workspace.","solutions":["Verify the prompt exists: open Arize Phoenix (Prompts tab) or call the Phoenix client (client.get_prompt(prompt_id)) and confirm the exact prompt_id spelling","Check the Phoenix connection settings (ARIZE_PHOENIX endpoint / API key env vars or however the integration was initialized) so that _load_prompt_from_arize can actually fetch prompts","If the prompt was renamed or versioned, update the model string / litellm_params to the current prompt_id","If prompts must be pre-loaded, call the prompt manager's load API at startup and fail loudly there instead of at request time"],"exampleFix":"# before\nresponse = litellm.completion(model=\"phoenix/my-prompt\", messages=[{\"role\": \"user\", \"content\": \"hi\"}])  # ValueError: Prompt template 'my-prompt' not found\n\n# after\n# confirm the prompt exists first\nimport phoenix as px\npx.Client().get_prompt(\"my-prompt\")  # raises early with a clearer error if missing\nresponse = litellm.completion(model=\"phoenix/my-prompt\", messages=[{\"role\": \"user\", \"content\": \"hi\"}])","handlingStrategy":"validation","validationCode":"from phoenix import Client\n\ndef prompt_exists(prompt_id: str) -> bool:\n    try:\n        px = Client()\n        px.get_prompt(prompt_id)\n        return True\n    except Exception:\n        return False\n\nassert prompt_exists(\"summarize-v2\"), \"prompt missing in Phoenix\"","typeGuard":"def is_valid_prompt_id(prompt_id: str | None) -> bool:\n    return isinstance(prompt_id, str) and bool(prompt_id.strip())","tryCatchPattern":"try:\n    resp = litellm.completion(model=f\"phoenix/{prompt_id}\", messages=[...])\nexcept ValueError as e:\n    if \"not found\" in str(e):\n        # unknown prompt: surface config error, do not retry\n        raise ConfigError(f\"Phoenix prompt {prompt_id} missing\") from e\n    raise","preventionTips":["Keep prompt IDs in a single config/manifest validated at deploy time against Phoenix","Run a startup health check that loads every configured prompt_id once","Avoid renaming prompts in Phoenix without a corresponding litellm config update","Alert on Phoenix load failures so the prompt cache is never silently empty"],"tags":["arize-phoenix","prompt-management","configuration","valueerror"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}