{"record":{"id":"8cc4b95f342ac2da","repo":"BerriAI/litellm","slug":"error-fetching-prompt-version-prompt-version-id","errorCode":null,"errorMessage":"Error fetching prompt version '{prompt_version_id}': {e}","messagePattern":"Error fetching prompt version '(.+?)': (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/arize/arize_phoenix_client.py","lineNumber":92,"sourceCode":"            data: Final = response.json()\n            return data.get(\"data\")\n\n        except Exception as e:\n            # Check if it's an HTTP error\n            response = getattr(e, \"response\", None)\n            if response is not None and hasattr(response, \"status_code\"):\n                if response.status_code == 404:\n                    return None\n                elif response.status_code == 403:\n                    raise Exception(\n                        f\"Access denied to prompt version '{prompt_version_id}'. Check your Arize Phoenix permissions.\"\n                    )\n                elif response.status_code == 401:\n                    raise Exception(\"Authentication failed. Check your Arize Phoenix API key and permissions.\")\n                else:\n                    raise Exception(f\"Failed to fetch prompt version '{prompt_version_id}': {e}\")\n            else:\n                raise Exception(f\"Error fetching prompt version '{prompt_version_id}': {e}\")\n\n    def test_connection(self) -> bool:\n        \"\"\"\n        Test the connection to the Arize Phoenix API.\n\n        Returns:\n            True if connection is successful, False otherwise\n        \"\"\"\n        try:\n            # Try to access the prompt_versions endpoint to test connection\n            url: Final = f\"{self.api_base}/prompt_versions\"\n            response: Final = self.http_handler.client.get(url, headers=self.headers)\n            response.raise_for_status()\n            return True\n        except Exception:\n            return False\n\n    def close(self):","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/arize/arize_phoenix_client.py#L74-L110","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import httpx, os\n\ntry:\n    httpx.get(f\"{api_base}/prompt_versions\", headers={\"Authorization\": f\"Bearer {os.environ['PHOENIX_API_KEY']}\"}, timeout=5)\nexcept httpx.ConnectError:\n    raise SystemExit(f\"Phoenix unreachable at {api_base} — check host/port/network before enabling prompts\")","typeGuard":null,"tryCatchPattern":"try:\n    manager.compile(prompt_id=prompt_id, prompt_variables=vars)\nexcept Exception as e:\n    msg = str(e)\n    if \"Error fetching prompt version\" in msg and any(k in msg for k in (\"Connect\", \"DNS\", \"timeout\")):\n        # transport-level: safe to retry after a short backoff; if persistent, fix network/api_base\n        time.sleep(2)\n        return manager.compile(prompt_id=prompt_id, prompt_variables=vars)\n    raise","preventionTips":["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"],"tags":["arize-phoenix","network","connection-error","prompts","timeout"],"backgroundTag":"connection-error","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}