BerriAI/litellm · error · ValueError

Prompt version ' ' not found

Error message

Prompt version '{prompt_version_id}' not found

What it means

Inside _load_prompt_from_arize, if the client successfully fetched a response but it contained no prompt data (the 404 branch of get_prompt_version returns None), the manager raises ValueError('Prompt version … not found'). It distinguishes 'asked Phoenix, got nothing' from transport/auth failures, which take the other branches.

Solutions

  1. Open the prompt in the Phoenix UI and copy the exact current prompt/version ID into prompt_id
  2. Confirm you are pointing at the same Phoenix instance/workspace the prompt lives in (check api_base)
  3. If the prompt was recreated, update your litellm model config to the new identifier

Example fix

# before
litellm_params:
  model: openai/gpt-4o
  prompt_id: UHJvbXB0OjE  # deleted in Phoenix -> not found

# after
litellm_params:
  model: openai/gpt-4o
  prompt_id: UHJvbXB0OjI  # current ID from Phoenix UI
Defensive patterns

Strategy: validation

Validate before calling

import httpx, os

resp = httpx.get(
    f"{api_base}/prompt_versions/{prompt_version_id}",
    headers={"Authorization": f"Bearer {os.environ['PHOENIX_API_KEY']}"},
    timeout=5,
)
if resp.status_code == 404:
    raise SystemExit(f"prompt version {prompt_version_id} does not exist in this Phoenix workspace")

Try / catch

try:
    manager.compile(prompt_id=prompt_id, prompt_variables=vars)
except Exception as e:
    if "not found" in str(e):
        raise SystemExit(f"prompt {prompt_id} missing in Phoenix — verify ID and workspace, then update config") from e
    raise

Prevention

When it happens

Trigger: Loading a prompt_id/prompt_version_id that does not exist in the target Phoenix workspace — wrong ID, deleted prompt, or an ID copied from another environment (dev ID used against prod). Also when Phoenix returns an envelope whose 'data' is null/empty.

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.

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 BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ff3ece6dd3f2d27a. Report an issue: GitHub.

Appendix: source

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

            comment_start_string="{#",
            comment_end_string="#}",
        )

        # 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:

View on GitHub (pinned to 77b7c6c40c)