{"record":{"id":"a79ba64901d81ffe","repo":"BerriAI/litellm","slug":"error-compiling-prompt-prompt-id-e-a79ba6","errorCode":null,"errorMessage":"Error compiling prompt '{prompt_id}': {e}","messagePattern":"Error compiling prompt '(.+?)': (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/bitbucket/bitbucket_prompt_manager.py","lineNumber":480,"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=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 BitBucket operations use sync client,\n        this simply delegates to the sync version.\n        \"\"\"\n        if prompt_id is None:\n            raise ValueError(\"prompt_id is required for BitBucket prompt manager\")\n\n        return self._compile_prompt_helper(","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/bitbucket/bitbucket_prompt_manager.py#L462-L498","documentation":"ValueError wrapping any failure inside _compile_prompt_helper after the prompt_id guard: BitBucket fetch errors, missing templates, Jinja render errors from malformed templates, YAML frontmatter parse problems, or message-parsing failures all collapse into this single message. The inner exception text is appended, so the root cause is only available as a string. The wrapping to ValueError also erases the distinction between infra errors (should be retried) and content errors (should not).","triggerScenarios":"Compiling a prompt whose .prompt file has invalid Jinja2 syntax, frontmatter that fails to parse into model/temperature fields, a network/auth failure during _load_prompt_from_bitbucket, or a template id that was never loaded (the 349 error) — any of these is re-wrapped here.","commonSituations":"Editing a prompt file directly in BitBucket and introducing a typo; environment variable changes breaking auth mid-run; deploying prompt edits without previewing the rendered template.","solutions":["Read the tail of the message — it contains the underlying exception text; fix that root cause first","Test edited .prompt files locally with the same frontmatter parser before committing to BitBucket","Separate infrastructure failures (retry) from template errors (fix content) in your error handling around compile_prompt","Ensure auth/network are healthy with test_connection() before blaming the template"],"exampleFix":"# before\ncompiled = await client.async_compile_prompt_helper(\"summary\", vars, dynamic_params)\n\n# after (surface the root cause)\ntry:\n    compiled = await client.async_compile_prompt_helper(\"summary\", vars, dynamic_params)\nexcept ValueError as e:\n    logger.error(\"Prompt 'summary' failed to compile: %s\", e)\n    raise  # fix the underlying issue named in the message","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    compiled = await client.async_compile_prompt_helper(prompt_id, variables, dynamic_params)\nexcept ValueError as e:\n    msg = str(e)\n    if \"Authentication failed\" in msg or \"Access denied\" in msg:\n        alert_ops(f\"BitBucket credential problem: {msg}\")\n    elif \"not found\" in msg:\n        raise KeyError(f\"prompt '{prompt_id}' missing\") from e\n    else:\n        raise  # likely template content error — fix the .prompt file","preventionTips":["Preview-render prompt files in CI after every edit to the prompts repo","Log the wrapped message verbatim; the tail names the root cause","Separate retryable (network/auth) from permanent (content) failures in handlers"],"tags":["bitbucket","prompts","jinja2","error-wrapping"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}