BerriAI/litellm · error · Exception
Error fetching prompt version
Error message
Error fetching prompt version '{prompt_version_id}': {e} What it means
Companion branch in ArizePhoenixClient.get_prompt_version: raised when the caught exception has no attached HTTP response — i.e. the request never completed. Typical causes are DNS resolution failure, connection refused, TLS errors, or timeouts raised by httpx before/transport-level, rather than a Phoenix status code.
Solutions
- Verify Phoenix is reachable from where litellm runs: `curl <api_base>/prompt_versions -H "Authorization: Bearer $PHOENIX_API_KEY"`
- Fix the api_base hostname/port; for local dev, ensure Phoenix is actually listening on 6006
- If behind a proxy, configure HTTPS_PROXY/HTTP_PROXY for the process or extend the client's timeout
Defensive patterns
Strategy: retry
Validate before calling
import httpx, os
try:
httpx.get(f"{api_base}/prompt_versions", headers={"Authorization": f"Bearer {os.environ['PHOENIX_API_KEY']}"}, timeout=5)
except httpx.ConnectError:
raise SystemExit(f"Phoenix unreachable at {api_base} — check host/port/network before enabling prompts") Try / catch
try:
manager.compile(prompt_id=prompt_id, prompt_variables=vars)
except Exception as e:
msg = str(e)
if "Error fetching prompt version" in msg and any(k in msg for k in ("Connect", "DNS", "timeout")):
# transport-level: safe to retry after a short backoff; if persistent, fix network/api_base
time.sleep(2)
return manager.compile(prompt_id=prompt_id, prompt_variables=vars)
raise Prevention
- Health-check the Phoenix api_base from the litellm process before enabling prompt routing
- For local dev, script 'start Phoenix, wait for :6006, then start proxy' ordering
When it happens
Trigger: api_base host unreachable (wrong hostname, Phoenix not running locally, network policy blocking egress), DNS failure, or a slow Phoenix causing the client timeout while GETting the prompt version.
Common situations: Local development with Phoenix not started (connection refused on localhost:6006); typo in api_base; k8s NetworkPolicy blocking the proxy-to-Phoenix path; corporate proxy/MTLS requirements not configured for the httpx client.
Related errors
- Access denied to prompt version
- api_key and api_base are required for Arize Phoenix prompt…
- APIConnectionError
- Authentication failed. Check your Arize Phoenix API key and…
- BedrockException: Timeout Error
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8cc4b95f342ac2da.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/arize/arize_phoenix_client.py:92
data: Final = response.json()
return data.get("data")
except Exception as e:
# Check if it's an HTTP error
response = getattr(e, "response", None)
if response is not None and hasattr(response, "status_code"):
if response.status_code == 404:
return None
elif response.status_code == 403:
raise Exception(
f"Access denied to prompt version '{prompt_version_id}'. Check your Arize Phoenix permissions."
)
elif response.status_code == 401:
raise Exception("Authentication failed. Check your Arize Phoenix API key and permissions.")
else:
raise Exception(f"Failed to fetch prompt version '{prompt_version_id}': {e}")
else:
raise Exception(f"Error fetching prompt version '{prompt_version_id}': {e}")
def test_connection(self) -> bool:
"""
Test the connection to the Arize Phoenix API.
Returns:
True if connection is successful, False otherwise
"""
try:
# Try to access the prompt_versions endpoint to test connection
url: Final = f"{self.api_base}/prompt_versions"
response: Final = self.http_handler.client.get(url, headers=self.headers)
response.raise_for_status()
return True
except Exception:
return False
def close(self):View on GitHub (pinned to 77b7c6c40c)