{"record":{"id":"c68fe430bcf187d4","repo":"BerriAI/litellm","slug":"prompt-template-prompt-id-not-found-c68fe4","errorCode":null,"errorMessage":"Prompt template '{prompt_id}' not found","messagePattern":"Prompt template '(.+?)' not found","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/gitlab/gitlab_prompt_manager.py","lineNumber":325,"sourceCode":"                prompt_id=self.prompt_id,\n                ref=self._ref_override,\n                gitlab_client=self._injected_gitlab_client,\n            )\n        return self._prompt_manager\n\n    def get_prompt_template(\n        self,\n        prompt_id: str,\n        prompt_variables: dict[str, Any] | None = None,\n        *,\n        ref: str | None = None,\n    ) -> tuple[str, dict[str, Any]]:\n        if prompt_id not in self.prompt_manager.prompts:\n            self.prompt_manager._load_prompt_from_gitlab(prompt_id, ref=ref)\n\n        template: Final = self.prompt_manager.get_template(prompt_id)\n        if not template:\n            raise ValueError(f\"Prompt template '{prompt_id}' not found\")\n\n        rendered_prompt: Final = self.prompt_manager.render_template(prompt_id, prompt_variables or {})\n\n        metadata: Final = {\n            \"model\": template.model,\n            \"temperature\": template.temperature,\n            \"max_tokens\": template.max_tokens,\n            **template.optional_params,\n        }\n        return rendered_prompt, metadata\n\n    def pre_call_hook(\n        self,\n        user_id: str | None,\n        messages: list[AllMessageValues],\n        function_call: dict[str, Any] | str | None = None,\n        litellm_params: dict[str, Any] | None = None,\n        prompt_id: str | None = None,","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/gitlab/gitlab_prompt_manager.py#L307-L343","documentation":"ValueError raised by CustomGitLabPromptManagement.get_prompt_template when, after attempting a lazy load via _load_prompt_from_gitlab, the template still isn't in the manager. The silent-None path: get_file_content returns None on 404, so the template is never cached, and this error surfaces the miss.","triggerScenarios":"Calling get_prompt_template with a prompt_id whose .prompt file does not exist in the repo at the resolved path (404 -> content None -> no template), or when the prompts_path prefix misroutes the id to a nonexistent location.","commonSituations":"Prompt file deleted or renamed in GitLab; prompts_path config pointing at the wrong directory; id passed with the '.prompt' extension or a leading slash causing path mismatch; ref (branch) that lacks the file.","solutions":["Confirm the file exists: browse the repo at the exact path _id_to_repo_path produces for your id","Check prompts_path setting matches where .prompt files live","Pass the id exactly as returned by list_templates()","If using ref, ensure the branch/tag actually contains the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"available = prompt_manager.list_templates()\nif prompt_id not in available:\n    raise LookupError(f\"prompt '{prompt_id}' missing; available: {available}\")","typeGuard":null,"tryCatchPattern":"try:\n    rendered, meta = handler.get_prompt_template(pid, variables, ref=ref)\nexcept ValueError as e:\n    if \"not found\" in str(e):\n        # 404 path: file absent at ref — handle gracefully\n        raise LookupError(f\"prompt file missing in GitLab at ref={ref}\") from e\n    raise","preventionTips":["Cross-check prompt ids against list_templates() output","Verify prompts_path config matches repo layout","Test the ref actually contains the file before pinning it"],"tags":["gitlab","prompt-management","litellm","not-found"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}