{"record":{"id":"28a03850bed8d3f6","repo":"BerriAI/litellm","slug":"error-compiling-prompt-prompt-id-e","errorCode":null,"errorMessage":"Error compiling prompt '{prompt_id}': {e}","messagePattern":"Error compiling prompt '(.+?)': (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/arize/arize_phoenix_prompt_manager.py","lineNumber":419,"sourceCode":"                \"temperature\",\n                \"max_tokens\",\n                \"top_p\",\n                \"frequency_penalty\",\n                \"presence_penalty\",\n            ]:\n                if param in prompt_metadata:\n                    optional_params[param] = prompt_metadata[param]\n\n            return PromptManagementClient(\n                prompt_id=prompt_id,\n                prompt_template=rendered_messages,\n                prompt_template_model=template_model,\n                prompt_template_optional_params=optional_params,\n                completed_messages=None,\n            )\n\n        except Exception as e:\n            raise ValueError(f\"Error compiling prompt '{prompt_id}': {e}\")\n\n    async def async_compile_prompt_helper(\n        self,\n        prompt_id: str | None,\n        prompt_variables: dict | None,\n        dynamic_callback_params: StandardCallbackDynamicParams,\n        prompt_spec: PromptSpec | None = None,\n        prompt_label: str | None = None,\n        prompt_version: int | None = None,\n    ) -> PromptManagementClient:\n        \"\"\"\n        Async version of compile prompt helper. Since Arize Phoenix operations are synchronous,\n        this simply delegates to the sync version.\n        \"\"\"\n        if prompt_id is None:\n            raise ValueError(\"prompt_id is required for Arize Phoenix prompt manager\")\n        return self._compile_prompt_helper(\n            prompt_id=prompt_id,","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/arize/arize_phoenix_prompt_manager.py#L401-L437","documentation":"A catch-all ValueError thrown at the end of the sync Phoenix compile helper when any exception escapes the try block while loading or rendering a prompt. The original exception is stringified into the message, so the real cause (network error, auth failure, template render error, KeyError in metadata) is nested in '{e}'. It masks the original exception type, so you must read the embedded text to diagnose.","triggerScenarios":"Phoenix API unreachable or returning errors during _load_prompt_from_arize; invalid API key for Phoenix; template variables that fail during render_template (e.g. malformed template or incompatible variables); any unexpected exception while building the PromptManagementClient.","commonSituations":"Phoenix endpoint down or DNS failure; expired/incorrect Phoenix credentials; prompt template uses syntax the renderer rejects; transient 5xx from Phoenix during load; a prompt whose metadata is missing expected keys in a newer/older litellm version.","solutions":["Read the '{e}' suffix of the message — it contains the underlying exception text; fix that root cause first","Reproduce the load outside litellm: call the Phoenix client (get_prompt / render) directly with the same prompt_id and variables","Check Phoenix connectivity and credentials (endpoint URL, API key) from the environment where litellm runs","If the embedded error is a render error, test the template with the same prompt_variables in the Phoenix UI"],"exampleFix":"# before\ntry:\n    client = manager._compile_prompt_helper(None, None, params)  # nested ValueError hides cause\nexcept ValueError as e:\n    pass  # real cause buried in message text\n\n# after\n# go through the public entry point and log the full chain\nimport logging\ntry:\n    result = litellm.completion(model=\"phoenix/summarize-v2\", messages=[...])\nexcept ValueError as e:\n    logging.exception(\"phoenix compile failed: %s\", e)  # full text incl. embedded cause","handlingStrategy":"retry","validationCode":"def can_reach_phoenix(endpoint: str, headers: dict) -> bool:\n    import httpx\n    try:\n        r = httpx.get(f\"{endpoint}/v1/prompts\", headers=headers, timeout=5)\n        return r.status_code < 500\n    except httpx.HTTPError:\n        return False","typeGuard":null,"tryCatchPattern":"import time\nfor attempt in range(3):\n    try:\n        result = litellm.completion(model=f\"phoenix/{prompt_id}\", messages=[...])\n        break\n    except ValueError as e:\n        msg = str(e)\n        if any(k in msg for k in (\"timeout\", \"connection\", \"503\", \"429\")) and attempt < 2:\n            time.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Pre-warm and cache rendered prompts at startup so request-time Phoenix failures are rarer","Log the full message — the root cause is always embedded after the colon","Monitor Phoenix availability separately from litellm health checks","Pin prompt variables to the schema defined in Phoenix to avoid render errors"],"tags":["arize-phoenix","prompt-management","exception-wrapping","valueerror"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}