{"record":{"id":"300b04a2dfa4c4a3","repo":"BerriAI/litellm","slug":"error-compiling-prompt-prompt-id-e-300b04","errorCode":null,"errorMessage":"Error compiling prompt '{prompt_id}': {e}","messagePattern":"Error compiling prompt '(.+?)': (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/gitlab/gitlab_prompt_manager.py","lineNumber":520,"sourceCode":"            for param in [\n                \"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        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 GitLab 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 GitLab prompt manager\")\n\n        return self._compile_prompt_helper(","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/gitlab/gitlab_prompt_manager.py#L502-L538","documentation":"ValueError wrapper at the end of _compile_prompt_helper: any exception during GitLab load, template rendering (including Jinja errors), metadata extraction, or message assembly is re-raised with this message. It is the funnel for errors 467-470 during completion-time prompt compilation.","triggerScenarios":"A completion call with prompt_id where the GitLab fetch fails (auth/network/404), Jinja rendering raises on bad syntax or missing variables, or the .prompt frontmatter is malformed so metadata parsing breaks.","commonSituations":"Prompt template references a variable not supplied in prompt_variables; .prompt file edited with invalid Jinja syntax; expired GitLab token at runtime; production hitting this only after a repo change while local worked.","solutions":["Read the chained text after the colon — it names the true failure","For Jinja errors, test the template locally with jinja2.Environment().from_string(...).render(**vars)","Supply all variables the template references via prompt_variables","For GitLab fetch errors, follow fixes for errors 460-462/467"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    pmc = handler._compile_prompt_helper(prompt_id, spec, variables, params)\nexcept ValueError as e:\n    inner = str(e)\n    if \"Failed to load\" in inner:\n        raise RuntimeError(\"GitLab fetch failed — check token/network\") from e\n    if \"not found\" in inner:\n        raise LookupError(inner) from e\n    raise","preventionTips":["Dry-run render templates with expected variables at deploy time","Keep chained exception context when re-wrapping","Pin prompt file changes via code review to catch Jinja breakage"],"tags":["litellm","prompt-management","gitlab","wrapper-exception","jinja"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}