{"record":{"id":"f3ce7c29dcb6dbc7","repo":"BerriAI/litellm","slug":"failed-to-load-prompt-encode-prompt-id-prompt-id","errorCode":null,"errorMessage":"Failed to load prompt '{encode_prompt_id(prompt_id)}' from GitLab: {e}","messagePattern":"Failed to load prompt '(.+?)' from GitLab: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/gitlab/gitlab_prompt_manager.py","lineNumber":142,"sourceCode":"        path = repo_path.strip(\"/\")\n        if self.prompts_path and path.startswith(self.prompts_path.strip(\"/\") + \"/\"):\n            path = path[len(self.prompts_path.strip(\"/\")) + 1 :]\n        path = path.removesuffix(\".prompt\")\n        return encode_prompt_id(path)\n\n    # ---------- loading ----------\n\n    def _load_prompt_from_gitlab(self, prompt_id: str, *, ref: str | None = None) -> None:\n        \"\"\"Load a specific .prompt file from GitLab (scoped under prompts_path if set).\"\"\"\n        try:\n            # prompt_id = decode_prompt_id(prompt_id)\n            file_path: Final = self._id_to_repo_path(prompt_id)\n            prompt_content: Final = self.gitlab_client.get_file_content(file_path, ref=ref)\n            if prompt_content:\n                template: Final = self._parse_prompt_file(prompt_content, prompt_id)\n                self.prompts[prompt_id] = template\n        except Exception as e:\n            raise Exception(f\"Failed to load prompt '{encode_prompt_id(prompt_id)}' from GitLab: {e}\")\n\n    def load_all_prompts(self, *, recursive: bool = True) -> list[str]:\n        \"\"\"\n        Eagerly load all .prompt files from prompts_path. Returns loaded IDs.\n        \"\"\"\n        files: Final = self.list_templates(recursive=recursive)\n        loaded: Final[list[str]] = []\n        for pid in files:\n            if pid not in self.prompts:\n                self._load_prompt_from_gitlab(pid)\n            loaded.append(pid)\n        return loaded\n\n    # ---------- parsing & rendering ----------\n\n    def _parse_prompt_file(self, content: str, prompt_id: str) -> GitLabPromptTemplate:\n        if content.startswith(\"---\"):\n            parts: Final = content.split(\"---\", 2)","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/gitlab/gitlab_prompt_manager.py#L124-L160","documentation":"Loading a .prompt file from GitLab for the decoded prompt_id failed (network, auth, or missing-repo error interpolated); the manager re-raises so the prompt-loading failure is visible instead of silently skipping the template.","triggerScenarios":"Loading a prompt from GitLab fails because the file is missing, the ref is wrong, or the API request errors.","commonSituations":"Misconfigured gitlab_config, missing prompt file in the repo, or insufficient token scope.","solutions":["Check that the prompt_id maps to an existing file in the GitLab repository.","Verify GitLab credentials and repository configuration in gitlab_config.","Retry after resolving the underlying GitLab client error shown in the message."],"exampleFix":"prompt = gitlab_prompt_manager.get_prompt('prompts/support_bot.prompt')","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}