BerriAI/litellm · error · ValueError

Gitlab configuration not found. Please set…

Error message

Gitlab configuration not found. Please set litellm.global_gitlab_config first.

What it means

Raised while initializing LiteLLM's GitLab prompt-management/logging integration. LiteLLM does not read GitLab credentials from environment variables; it expects a config dict on the litellm module (litellm.global_gitlab_config, normally set via litellm.set_global_gitlab_config()). If no GitLabPromptManager is already cached in _in_memory_loggers and that global is None, this ValueError fires before any GitLab API call is attempted.

Solutions

  1. Call litellm.set_global_gitlab_config({"project": "group/repo", "access_token": "glpat-...", "base_url": "https://gitlab.example.com", "prompts_path": "src/prompts", "branch": "main"}) before the first gitlab/ request
  2. On the proxy, put the same dict under litellm_settings.global_gitlab_config in config.yaml so it is applied at startup
  3. Or assign litellm.global_gitlab_config = {...} directly; it is a plain dict
  4. Verify the integration initialized: litellm.logging_callback_manager.get_custom_loggers_for_type(GitLabPromptManager) should be non-empty

Example fix

// before
import litellm
resp = litellm.completion(model="gitlab/gpt-4", prompt_id="prompts/chat", messages=[{"role": "user", "content": "hi"}])
# ValueError: Gitlab configuration not found

// after
import litellm
litellm.set_global_gitlab_config({
    "project": "group/repo",
    "access_token": "glpat-...",
    "base_url": "https://gitlab.example.com",
    "prompts_path": "src/prompts",
    "branch": "main",
})
resp = litellm.completion(model="gitlab/gpt-4", prompt_id="prompts/chat", messages=[{"role": "user", "content": "hi"}])
Defensive patterns

Strategy: validation

Validate before calling

import litellm

if getattr(litellm, "global_gitlab_config", None) is None:
    litellm.set_global_gitlab_config({
        "project": "group/repo",
        "access_token": os.environ["GITLAB_ACCESS_TOKEN"],
        "base_url": "https://gitlab.example.com",
    })
# only now enable/use the gitlab integration

Try / catch

Wrap the first gitlab-enabled request in try/except ValueError; on the 'set litellm.global_gitlab_config' message, apply the config and retry once.

Prevention

When it happens

Trigger: Calling litellm.completion(model="gitlab/gpt-4", prompt_id=...) or resolving the "gitlab" logging integration when litellm.global_gitlab_config was never assigned; on the proxy, a config.yaml that routes gitlab/* models but has no litellm_settings.global_gitlab_config block.

Common situations: Copying the GitLab prompt-management example but skipping the set_global_gitlab_config step; assuming a GITLAB_ACCESS_TOKEN env var is picked up; assigning the global after the first request already initialized callbacks; proxy deployments missing the global_gitlab_config yaml block so proxy_server.py never calls set_global_gitlab_config.

Related errors


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

Appendix: source

Thrown at litellm/litellm_core_utils/litellm_logging.py:4350

            if bitbucket_config is None:
                raise ValueError("BitBucket configuration not found. Please set litellm.global_bitbucket_config first.")

            bitbucket_logger: Final = BitBucketPromptManager(bitbucket_config=bitbucket_config)
            _in_memory_loggers.append(bitbucket_logger)
            return bitbucket_logger
        elif logging_integration == "gitlab":
            from litellm.integrations.gitlab.gitlab_prompt_manager import (
                GitLabPromptManager,
            )

            for callback in _in_memory_loggers:
                if isinstance(callback, GitLabPromptManager):
                    return callback

            # Get global BitBucket config
            gitlab_config: Final = getattr(litellm, "global_gitlab_config", None)
            if gitlab_config is None:
                raise ValueError("Gitlab configuration not found. Please set litellm.global_gitlab_config first.")

            gitlab_logger: Final = GitLabPromptManager(gitlab_config=gitlab_config)
            _in_memory_loggers.append(gitlab_logger)
            return gitlab_logger
        elif logging_integration == "newrelic":
            for callback in _in_memory_loggers:
                if isinstance(callback, NewRelicLogger):
                    return callback
            newrelic_logger: Final = NewRelicLogger()
            _in_memory_loggers.append(newrelic_logger)
            return newrelic_logger
        return None
    except Exception as e:
        verbose_logger.exception("[Non-Blocking Error] Error initializing custom logger: %s", e)
        return None
    return None

View on GitHub (pinned to 77b7c6c40c)