BerriAI/litellm · error · ValueError
gitlab_config is required for gitlab prompt integration
Error message
gitlab_config is required for gitlab prompt integration
What it means
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.
Source
Thrown at litellm/integrations/gitlab/__init__.py:42
- workspace: gitlab workspace name
- repository: Repository name
- access_token: gitlab access token
- branch: Branch to fetch prompts from (default: main)
"""
import litellm
litellm.global_gitlab_config = config
def prompt_initializer(litellm_params: "PromptLiteLLMParams", prompt_spec: "PromptSpec") -> "CustomPromptManagement":
"""
Initialize a prompt from a Gitlab repository.
"""
gitlab_config: Final = getattr(litellm_params, "gitlab_config", None)
prompt_id: Final = getattr(litellm_params, "prompt_id", None)
if not gitlab_config:
raise ValueError("gitlab_config is required for gitlab prompt integration")
try:
gitlab_prompt_manager: Final = GitLabPromptManager(
gitlab_config=gitlab_config,
prompt_id=prompt_id,
)
return gitlab_prompt_manager
except Exception as e:
raise e
def _gitlab_prompt_initializer(
litellm_params: PromptLiteLLMParams,
prompt: PromptSpec,
) -> CustomPromptManagement:
"""
Build a GitLab-backed prompt manager for this prompt.View on GitHub (pinned to 6c2dcb801b)
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'.
Example fix
# before
litellm_params:
model: openai/gpt-4o
prompt_integration: gitlab
prompt_id: chat/greet
# after
litellm_params:
model: openai/gpt-4o
prompt_integration: gitlab
prompt_id: chat/greet
gitlab_config:
project: mygroup/myrepo
access_token: os.environ/GITLAB_TOKEN
branch: main
prompts_path: prompts Defensive patterns
Strategy: validation
Validate before calling
REQUIRED_GITLAB_KEYS = ("project", "access_token")
def validate_gitlab_prompt_config(litellm_params) -> dict:
cfg = getattr(litellm_params, "gitlab_config", None)
if not cfg:
raise ValueError("prompt_integration=gitlab requires a non-empty gitlab_config on litellm_params")
missing = [k for k in REQUIRED_GITLAB_KEYS if not cfg.get(k)]
if missing:
raise ValueError(f"gitlab_config missing required keys: {missing}")
return cfg Type guard
def is_valid_gitlab_config(cfg: object) -> bool:
return (
isinstance(cfg, dict)
and bool(cfg.get("project"))
and bool(cfg.get("access_token"))
) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- api_base is required in generic_prompt_config
- project and access_token are required
- prompt_id is required for GitLab prompt manager
- prompt_id is required for Arize Phoenix prompt manager
- Event hook {hook} is not in the supported event hooks {suppo
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/def9c67151358ee0.
Report an issue: GitHub.