{"record":{"id":"def9c67151358ee0","repo":"BerriAI/litellm","slug":"gitlab-config-is-required-for-gitlab-prompt-integr","errorCode":null,"errorMessage":"gitlab_config is required for gitlab prompt integration","messagePattern":"gitlab_config is required for gitlab prompt integration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/gitlab/__init__.py","lineNumber":42,"sourceCode":"                - workspace: gitlab workspace name\n                - repository: Repository name\n                - access_token: gitlab access token\n                - branch: Branch to fetch prompts from (default: main)\n    \"\"\"\n    import litellm\n\n    litellm.global_gitlab_config = config\n\n\ndef prompt_initializer(litellm_params: \"PromptLiteLLMParams\", prompt_spec: \"PromptSpec\") -> \"CustomPromptManagement\":\n    \"\"\"\n    Initialize a prompt from a Gitlab repository.\n    \"\"\"\n    gitlab_config: Final = getattr(litellm_params, \"gitlab_config\", None)\n    prompt_id: Final = getattr(litellm_params, \"prompt_id\", None)\n\n    if not gitlab_config:\n        raise ValueError(\"gitlab_config is required for gitlab prompt integration\")\n\n    try:\n        gitlab_prompt_manager: Final = GitLabPromptManager(\n            gitlab_config=gitlab_config,\n            prompt_id=prompt_id,\n        )\n\n        return gitlab_prompt_manager\n    except Exception as e:\n        raise e\n\n\ndef _gitlab_prompt_initializer(\n    litellm_params: PromptLiteLLMParams,\n    prompt: PromptSpec,\n) -> CustomPromptManagement:\n    \"\"\"\n    Build a GitLab-backed prompt manager for this prompt.","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/gitlab/__init__.py#L24-L60","documentation":"Raised by prompt_initializer() in the GitLab prompt integration when litellm_params.gitlab_config is missing or falsy. GitLab prompt management reads prompts as files from a GitLab repository, and gitlab_config (project, access_token, branch, prompts_path, etc.) is required to construct the GitLabPromptManager.","triggerScenarios":"Declaring a model with prompt_integration='gitlab' in config.yaml but omitting the gitlab_config block; passing gitlab_config: {} (empty dict is falsy); spelling the key 'gitlab' or 'gitlabConfig' so getattr returns None.","commonSituations":"First-time setup of GitLab-backed prompts where the author assumed repository details come from environment variables; config split across files where the gitlab_config include was forgotten; migrating from the generic prompt integration and leaving the old config shape.","solutions":["Add a gitlab_config dict under the model's litellm_params with at least project and access_token (and usually branch, prompts_path, base_url).","Verify the exact key name 'gitlab_config' — variant spellings are silently ignored.","If you meant to use a non-GitLab prompt API, switch prompt_integration to the correct value instead of 'gitlab'."],"exampleFix":"# before\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: gitlab\n  prompt_id: chat/greet\n\n# after\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: gitlab\n  prompt_id: chat/greet\n  gitlab_config:\n    project: mygroup/myrepo\n    access_token: os.environ/GITLAB_TOKEN\n    branch: main\n    prompts_path: prompts","handlingStrategy":"validation","validationCode":"REQUIRED_GITLAB_KEYS = (\"project\", \"access_token\")\n\ndef validate_gitlab_prompt_config(litellm_params) -> dict:\n    cfg = getattr(litellm_params, \"gitlab_config\", None)\n    if not cfg:\n        raise ValueError(\"prompt_integration=gitlab requires a non-empty gitlab_config on litellm_params\")\n    missing = [k for k in REQUIRED_GITLAB_KEYS if not cfg.get(k)]\n    if missing:\n        raise ValueError(f\"gitlab_config missing required keys: {missing}\")\n    return cfg","typeGuard":"def is_valid_gitlab_config(cfg: object) -> bool:\n    return (\n        isinstance(cfg, dict)\n        and bool(cfg.get(\"project\"))\n        and bool(cfg.get(\"access_token\"))\n    )","tryCatchPattern":null,"preventionTips":["Validate gitlab_config in a config linter before deploying the proxy.","Use os.environ/VAR references for access_token so the value exists at startup, not at request time.","Copy from a known-good example entry when adding new GitLab prompt models."],"tags":["gitlab","prompt-management","config","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}