{"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":"exception","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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/gitlab/__init__.py#L24-L60","documentation":"The legacy GitLab prompt initializer (prompt_initializer in litellm/integrations/gitlab/__init__.py) found no gitlab_config on the prompt's litellm_params. The GitLab prompt integration stores all connection details (project, access_token, branch, prompts_path) in that dict, so an absent, None or empty (falsy) dict aborts initialization before any GitLab request is made.","triggerScenarios":"Declaring a prompt with prompt_integration='gitlab' but omitting litellm_params.gitlab_config; passing gitlab_config={} (the truthiness check rejects empty dicts too); misspelling the key (gitlabConfig, gitlab_cfg); nesting the dict at the top level of the prompt spec instead of under litellm_params.","commonSituations":"config.yaml prompt definitions missing the gitlab_config block; token-assembly code producing an empty dict when env vars are unset; copy-pasting a prompt spec from another integration without adapting the config key; version drift in where the initializer looks for the attribute.","solutions":["Add a non-empty gitlab_config dict under litellm_params with at least project and access_token","Check key spelling and nesting: it must be litellm_params.gitlab_config.project / .access_token","If config is env-driven, build the dict first and fail fast when it would be empty","Alternatively set a global config via litellm.integrations.gitlab.set_global_gitlab_config"],"exampleFix":"# before\nprompt_spec = {\n    \"prompt_id\": \"chat/greet\",\n    \"litellm_params\": {\"prompt_integration\": \"gitlab\"},\n}\n\n# after\nprompt_spec = {\n    \"prompt_id\": \"chat/greet\",\n    \"litellm_params\": {\n        \"prompt_integration\": \"gitlab\",\n        \"gitlab_config\": {\n            \"project\": \"mygroup/myrepo\",\n            \"access_token\": os.environ[\"GITLAB_TOKEN\"],\n            \"branch\": \"main\",\n        },\n    },\n}","handlingStrategy":"validation","validationCode":"def validate_gitlab_prompt_spec(prompt_spec: dict) -> None:\n    cfg = (prompt_spec.get(\"litellm_params\") or {}).get(\"gitlab_config\")\n    if not cfg:\n        raise ValueError(\n            \"prompt '%s' uses the gitlab integration but has no non-empty \"\n            \"litellm_params.gitlab_config\" % prompt_spec.get(\"prompt_id\")\n        )\n    missing = [k for k in (\"project\", \"access_token\") if cfg.get(k) is None]\n    if missing:\n        raise ValueError(f\"gitlab_config missing keys: {missing}\")","typeGuard":"from typing import Any\n\n\ndef has_gitlab_config(litellm_params: Any) -> bool:\n    \"\"\"True when litellm_params carries a non-empty gitlab_config.\"\"\"\n    return bool(getattr(litellm_params, \"gitlab_config\", None))","tryCatchPattern":"try:\n    manager = prompt_initializer(litellm_params, prompt_spec)\nexcept ValueError as e:\n    if \"gitlab_config is required\" in str(e):\n        raise RuntimeError(\n            \"GitLab prompt declared without gitlab_config - fix the prompt spec\"\n        ) from e\n    raise","preventionTips":["Validate every gitlab prompt spec at config-load time, not at request time","Assemble gitlab_config from env vars once and assert project/token are present","Keep an integration smoke test that initializes every registered prompt"],"tags":["gitlab","config","required-parameter","prompt-management"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}