{"record":{"id":"92cc72d43018800f","repo":"BerriAI/litellm","slug":"failed-to-load-prompt-version-prompt-version-id","errorCode":null,"errorMessage":"Failed to load prompt version '{prompt_version_id}' from Arize Phoenix: {e}","messagePattern":"Failed to load prompt version '(.+?)' from Arize Phoenix: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/arize/arize_phoenix_prompt_manager.py","lineNumber":108,"sourceCode":"        )\n\n        # Load prompt from Arize Phoenix if prompt_id is provided\n        if self.prompt_id:\n            self._load_prompt_from_arize(self.prompt_id)\n\n    def _load_prompt_from_arize(self, prompt_version_id: str) -> None:\n        \"\"\"Load a specific prompt version from Arize Phoenix.\"\"\"\n        try:\n            # Fetch the prompt version from Arize Phoenix\n            prompt_data: Final = self.arize_client.get_prompt_version(prompt_version_id)\n\n            if prompt_data:\n                template: Final = self._parse_prompt_data(prompt_data, prompt_version_id)\n                self.prompts[prompt_version_id] = template\n            else:\n                raise ValueError(f\"Prompt version '{prompt_version_id}' not found\")\n        except Exception as e:\n            raise Exception(f\"Failed to load prompt version '{prompt_version_id}' from Arize Phoenix: {e}\")\n\n    def _parse_prompt_data(self, data: dict[str, Any], prompt_version_id: str) -> ArizePhoenixPromptTemplate:\n        \"\"\"Parse Arize Phoenix prompt data and extract messages and metadata.\"\"\"\n        template_data: Final = data.get(\"template\", {})\n        messages: Final = template_data.get(\"messages\", [])\n\n        # Extract invocation parameters\n        invocation_params: Final = data.get(\"invocation_parameters\", {})\n        provider_params = {}\n\n        # Extract provider-specific parameters\n        if \"openai\" in invocation_params:\n            provider_params = invocation_params[\"openai\"]\n        elif \"anthropic\" in invocation_params:\n            provider_params = invocation_params[\"anthropic\"]\n        else:\n            # Try to find any nested provider params\n            for key, value in invocation_params.items():","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/arize/arize_phoenix_prompt_manager.py#L90-L126","documentation":"This is the outer wrapper of _load_prompt_from_arize: any failure while fetching or parsing a prompt version — the ValueError for a missing prompt, 401/403 auth errors, transport failures, or a malformed payload during _parse_prompt_data — is re-raised as 'Failed to load prompt version <id> from Arize Phoenix: <cause>'. Read the ': <cause>' suffix to find the real problem; this message alone only tells you the load step failed.","triggerScenarios":"Any first use of an Arize Phoenix prompt (e.g. completion call with prompt_id routing, or explicit compile) triggers _load_prompt_from_arize; the wrapped cause is typically 'Prompt version … not found', 'Authentication failed…', 'Access denied…', or a network error.","commonSituations":"Environment mismatch (test prompt IDs against prod Phoenix); prompt deleted or recreated with a new version ID after a config was written; base64-style IDs truncated in copy-paste.","solutions":["Read the trailing cause in the message; resolve it using the fix for that underlying error (not-found -> correct ID, 401 -> fix key, 403 -> fix workspace/permissions, network -> fix api_base/reachability)","After fixing, re-trigger the load explicitly (call the prompt again) rather than relying on cached failure state","Add startup or health-check prompt loads so config problems surface at deploy time, not at first user request"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Surface prompt config problems at deploy time instead of first request\nfor pid in configured_prompt_ids:\n    try:\n        manager.prompt_manager._load_prompt_from_arize(pid)\n    except Exception as e:\n        raise SystemExit(f\"preflight failed for prompt {pid}: {e}\") from e","typeGuard":null,"tryCatchPattern":"try:\n    manager.compile(prompt_id=prompt_id, prompt_variables=vars)\nexcept Exception as e:\n    if \"Failed to load prompt version\" in str(e):\n        cause = str(e).rsplit(\":\", 1)[-1].strip()\n        log.error(\"Phoenix prompt load failed (cause: %s)\", cause)  # branch on the real cause\n    raise","preventionTips":["Always read the ': <cause>' suffix — the wrapper hides whether it is auth, 404, or network","Add prompt preflight loads to your deployment smoke tests"],"tags":["arize-phoenix","prompts","wrapper-exception","diagnostics"],"backgroundTag":"remote-api-http-error","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}