BerriAI/litellm · error · Exception

Failed to load prompt version

Error message

Failed to load prompt version '{prompt_version_id}' from Arize Phoenix: {e}

What it means

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.

Solutions

  1. 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)
  2. After fixing, re-trigger the load explicitly (call the prompt again) rather than relying on cached failure state
  3. Add startup or health-check prompt loads so config problems surface at deploy time, not at first user request
Defensive patterns

Strategy: try-catch

Validate before calling

# Surface prompt config problems at deploy time instead of first request
for pid in configured_prompt_ids:
    try:
        manager.prompt_manager._load_prompt_from_arize(pid)
    except Exception as e:
        raise SystemExit(f"preflight failed for prompt {pid}: {e}") from e

Try / catch

try:
    manager.compile(prompt_id=prompt_id, prompt_variables=vars)
except Exception as e:
    if "Failed to load prompt version" in str(e):
        cause = str(e).rsplit(":", 1)[-1].strip()
        log.error("Phoenix prompt load failed (cause: %s)", cause)  # branch on the real cause
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/92cc72d43018800f. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/arize/arize_phoenix_prompt_manager.py:108

        )

        # Load prompt from Arize Phoenix if prompt_id is provided
        if self.prompt_id:
            self._load_prompt_from_arize(self.prompt_id)

    def _load_prompt_from_arize(self, prompt_version_id: str) -> None:
        """Load a specific prompt version from Arize Phoenix."""
        try:
            # Fetch the prompt version from Arize Phoenix
            prompt_data: Final = self.arize_client.get_prompt_version(prompt_version_id)

            if prompt_data:
                template: Final = self._parse_prompt_data(prompt_data, prompt_version_id)
                self.prompts[prompt_version_id] = template
            else:
                raise ValueError(f"Prompt version '{prompt_version_id}' not found")
        except Exception as e:
            raise Exception(f"Failed to load prompt version '{prompt_version_id}' from Arize Phoenix: {e}")

    def _parse_prompt_data(self, data: dict[str, Any], prompt_version_id: str) -> ArizePhoenixPromptTemplate:
        """Parse Arize Phoenix prompt data and extract messages and metadata."""
        template_data: Final = data.get("template", {})
        messages: Final = template_data.get("messages", [])

        # Extract invocation parameters
        invocation_params: Final = data.get("invocation_parameters", {})
        provider_params = {}

        # Extract provider-specific parameters
        if "openai" in invocation_params:
            provider_params = invocation_params["openai"]
        elif "anthropic" in invocation_params:
            provider_params = invocation_params["anthropic"]
        else:
            # Try to find any nested provider params
            for key, value in invocation_params.items():

View on GitHub (pinned to 77b7c6c40c)