BerriAI/litellm · error · ValueError

prompt_id is required for GitLab prompt manager

Error message

prompt_id is required for GitLab prompt manager

What it means

Guard in GitLab prompt manager _compile_prompt_helper: prompt_id is None, but GitLab prompt management identifies prompts solely by prompt_id, so there is nothing to fetch from GitLab.

Solutions

  1. Pass prompt_id in the request when using the GitLab prompt manager.

Example fix

litellm.completion(model='gpt-4', prompt_id='my_prompt', messages=[{'role':'user','content':'hi'}])
Defensive patterns

Strategy: validation

When it happens

Trigger: Invoking the GitLab prompt manager without supplying prompt_id.

Common situations: Caller omitted prompt_id in the request payload or metadata.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/50756a628fe5b10d. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/gitlab/gitlab_prompt_manager.py:484

    def should_run_prompt_management(
        self,
        prompt_id: str | None,
        prompt_spec: PromptSpec | None,
        dynamic_callback_params: StandardCallbackDynamicParams,
    ) -> bool:
        return prompt_id is not None

    def _compile_prompt_helper(
        self,
        prompt_id: str | None,
        prompt_spec: PromptSpec | None,
        prompt_variables: dict | None,
        dynamic_callback_params: StandardCallbackDynamicParams,
        prompt_label: str | None = None,
        prompt_version: int | None = None,
    ) -> PromptManagementClient:
        if prompt_id is None:
            raise ValueError("prompt_id is required for GitLab prompt manager")

        try:
            decoded_id: Final = decode_prompt_id(prompt_id)
            if decoded_id not in self.prompt_manager.prompts:
                git_ref: Final = (
                    getattr(dynamic_callback_params, "extra", {}).get("git_ref")
                    if hasattr(dynamic_callback_params, "extra")
                    else None
                )
                self.prompt_manager._load_prompt_from_gitlab(decoded_id, ref=git_ref)

            rendered_prompt, prompt_metadata = self.get_prompt_template(prompt_id, prompt_variables)

            messages: Final = self._parse_prompt_to_messages(rendered_prompt)
            template_model: Final = prompt_metadata.get("model")

            optional_params: Final[dict[str, Any]] = {}
            for param in [

View on GitHub (pinned to 77b7c6c40c)