{"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":"exception","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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/arize/arize_phoenix_prompt_manager.py#L401-L437","documentation":"LiteLLM's Arize Phoenix prompt-management integration raises this ValueError as a catch-all: any exception thrown while loading the prompt from the Phoenix server (_load_prompt_from_arize) or rendering its template with your variables (get_prompt_template) is caught in _compile_prompt_helper and re-raised as \"Error compiling prompt '<id>': <cause>\". The text after the colon is the original exception and is the only clue to the real failure (connectivity, auth, unknown prompt id, or a template-variable error). It fires during a completion call with prompt management enabled, not at startup.","triggerScenarios":"A completion/acompletion call with the arize_phoenix prompt integration active where: (1) the Phoenix endpoint (PHOENIX_COLLECTOR_ENDPOINT / PHOENIX_HOST) is unreachable or misconfigured; (2) prompt_id does not exist on the Phoenix server so _load_prompt_from_arize fails; (3) the template references variables absent from prompt_variables so rendering raises; (4) the Phoenix API key is missing or invalid; (5) prompt metadata returned by Phoenix has an unexpected shape.","commonSituations":"Wrong or missing PHOENIX_* env vars in the deployment; prompt renamed or deleted in the Phoenix UI leaving a stale prompt_id; passing prompt_variables={} or forgetting one required variable; Phoenix server upgrade changing the client API; self-hosted Phoenix instance blocked by firewall or mTLS.","solutions":["Read the suffix of the message after ': ' — it names the actual cause (connection error, KeyError on a variable, auth failure) and dictates the fix","Verify the Phoenix connection env vars (PHOENIX_COLLECTOR_ENDPOINT / PHOENIX_API_KEY, or the ARIZE_PHOENIX_* pair your setup uses)","Confirm the prompt_id exists server-side: call manager.get_available_prompts() or prompt_manager.list_templates() and compare","Pass every variable the template references via prompt_variables on the litellm call","If Phoenix was upgraded or the prompt migrated, re-save the prompt and confirm the id and version still resolve"],"exampleFix":"// before\nresponse = litellm.completion(\n    model=\"gpt-4o-mini\",\n    prompt_id=\"support-triage\",  # template uses {{ticket_text}}\n    messages=[],                 # no variables supplied -> render error wrapped in 280\n)\n// after\nresponse = litellm.completion(\n    model=\"gpt-4o-mini\",\n    prompt_id=\"support-triage\",\n    prompt_variables={\"ticket_text\": customer_ticket},\n    messages=[],\n)","handlingStrategy":"try-catch","validationCode":"available = mgr.get_available_prompts()\nif \"support-triage\" not in available:\n    raise SystemExit(f\"prompt_id not in Phoenix; available: {available}\")\nrequired_vars = {\"ticket_text\"}\nif not required_vars.issubset(prompt_variables or {}):\n    raise ValueError(f\"missing template variables: {required_vars - set(prompt_variables or {})}\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.completion(model=model, prompt_id=\"support-triage\",\n                              prompt_variables=variables)\nexcept ValueError as e:\n    if \"Error compiling prompt\" in str(e):\n        cause = str(e).split(\": \", 1)[-1]  # original exception text\n        logger.error(\"phoenix prompt compile failed: %s\", cause)\n        raise\n    raise","preventionTips":["Validate prompt_id against Phoenix's template list at startup","Preflight prompt_variables against the variables the template declares","Health-check the Phoenix endpoint before enabling the integration in production","Always log the wrapped suffix — it identifies the true root cause","Wrap prompt-managed calls in your own adapter so integration errors map to actionable messages"],"tags":["arize-phoenix","litellm","prompt-management","template-rendering","wrapper-exception"],"backgroundTag":"prompt-compilation-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}