{"record":{"id":"dc98e046cb026b35","repo":"BerriAI/litellm","slug":"gitlab-configuration-not-found-please-set-litellm","errorCode":null,"errorMessage":"Gitlab configuration not found. Please set litellm.global_gitlab_config first.","messagePattern":"Gitlab configuration not found\\. Please set litellm\\.global_gitlab_config first\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/litellm_logging.py","lineNumber":4350,"sourceCode":"            if bitbucket_config is None:\n                raise ValueError(\"BitBucket configuration not found. Please set litellm.global_bitbucket_config first.\")\n\n            bitbucket_logger: Final = BitBucketPromptManager(bitbucket_config=bitbucket_config)\n            _in_memory_loggers.append(bitbucket_logger)\n            return bitbucket_logger\n        elif logging_integration == \"gitlab\":\n            from litellm.integrations.gitlab.gitlab_prompt_manager import (\n                GitLabPromptManager,\n            )\n\n            for callback in _in_memory_loggers:\n                if isinstance(callback, GitLabPromptManager):\n                    return callback\n\n            # Get global BitBucket config\n            gitlab_config: Final = getattr(litellm, \"global_gitlab_config\", None)\n            if gitlab_config is None:\n                raise ValueError(\"Gitlab configuration not found. Please set litellm.global_gitlab_config first.\")\n\n            gitlab_logger: Final = GitLabPromptManager(gitlab_config=gitlab_config)\n            _in_memory_loggers.append(gitlab_logger)\n            return gitlab_logger\n        elif logging_integration == \"newrelic\":\n            for callback in _in_memory_loggers:\n                if isinstance(callback, NewRelicLogger):\n                    return callback\n            newrelic_logger: Final = NewRelicLogger()\n            _in_memory_loggers.append(newrelic_logger)\n            return newrelic_logger\n        return None\n    except Exception as e:\n        verbose_logger.exception(\"[Non-Blocking Error] Error initializing custom logger: %s\", e)\n        return None\n    return None\n\n","sourceCodeStart":4332,"sourceCodeEnd":4368,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/litellm_logging.py#L4332-L4368","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","On the proxy, put the same dict under litellm_settings.global_gitlab_config in config.yaml so it is applied at startup","Or assign litellm.global_gitlab_config = {...} directly; it is a plain dict","Verify the integration initialized: litellm.logging_callback_manager.get_custom_loggers_for_type(GitLabPromptManager) should be non-empty"],"exampleFix":"// before\nimport litellm\nresp = litellm.completion(model=\"gitlab/gpt-4\", prompt_id=\"prompts/chat\", messages=[{\"role\": \"user\", \"content\": \"hi\"}])\n# ValueError: Gitlab configuration not found\n\n// after\nimport litellm\nlitellm.set_global_gitlab_config({\n    \"project\": \"group/repo\",\n    \"access_token\": \"glpat-...\",\n    \"base_url\": \"https://gitlab.example.com\",\n    \"prompts_path\": \"src/prompts\",\n    \"branch\": \"main\",\n})\nresp = litellm.completion(model=\"gitlab/gpt-4\", prompt_id=\"prompts/chat\", messages=[{\"role\": \"user\", \"content\": \"hi\"}])","handlingStrategy":"validation","validationCode":"import litellm\n\nif getattr(litellm, \"global_gitlab_config\", None) is None:\n    litellm.set_global_gitlab_config({\n        \"project\": \"group/repo\",\n        \"access_token\": os.environ[\"GITLAB_ACCESS_TOKEN\"],\n        \"base_url\": \"https://gitlab.example.com\",\n    })\n# only now enable/use the gitlab integration","typeGuard":null,"tryCatchPattern":"Wrap the first gitlab-enabled request in try/except ValueError; on the 'set litellm.global_gitlab_config' message, apply the config and retry once.","preventionTips":["Set the gitlab config at import time, before any request or callback initialization","On the proxy, keep the litellm_settings.global_gitlab_config block in config.yaml under version control","Add a startup smoke test that makes one gitlab/ request before accepting traffic"],"tags":["gitlab","prompt-management","litellm","configuration"],"backgroundTag":"missing-configuration","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}