BerriAI/litellm · error · ValueError

BitBucket configuration not found. Please set…

Error message

BitBucket configuration not found. Please set litellm.global_bitbucket_config first.

What it means

Raised when the 'bitbucket' callback (BitBucketPromptManager, which resolves model='bitbucket/<name>' + prompt_id against .prompt files in a BitBucket repo) is instantiated: LiteLLM reads the global config from litellm.global_bitbucket_config, and if it is None (never set) this ValueError fires. The config is a dict of workspace/repository/access_token (plus optional branch, auth_method, username) that you must install via litellm.set_global_bitbucket_config() or, in the proxy, under litellm_settings.global_bitbucket_config in config.yaml.

Solutions

  1. In SDK code, call litellm.set_global_bitbucket_config({'workspace': ..., 'repository': ..., 'access_token': ..., 'branch': 'main'}) before any request.
  2. In the proxy, add litellm_settings: global_bitbucket_config: {workspace: ..., repository: ..., access_token: ...} to config.yaml.
  3. Check spelling/placement of the key and restart all workers so every process has the global set.

Example fix

# before
import litellm
litellm.completion(model='bitbucket/gpt-4', prompt_id='prompts/hello', messages=[...])
# ValueError: BitBucket configuration not found

# after
import litellm
litellm.set_global_bitbucket_config({'workspace': 'ws', 'repository': 'repo', 'access_token': 'x', 'branch': 'main'})
litellm.completion(model='bitbucket/gpt-4', prompt_id='prompts/hello', messages=[...])
Defensive patterns

Strategy: validation

Validate before calling

import litellm

required = {'workspace', 'repository', 'access_token'}
bitbucket_config = {'workspace': 'ws', 'repository': 'repo', 'access_token': os.environ['BITBUCKET_TOKEN']}
assert required <= set(bitbucket_config), f'bitbucket config missing: {required - set(bitbucket_config)}'
litellm.set_global_bitbucket_config(bitbucket_config)
resp = litellm.completion(model='bitbucket/gpt-4', prompt_id='prompts/hello', messages=[...])

Type guard

def bitbucket_config_is_valid(cfg: object) -> bool:
    return isinstance(cfg, dict) and {'workspace', 'repository', 'access_token'} <= set(cfg)

Try / catch

try:
    resp = litellm.completion(model='bitbucket/gpt-4', prompt_id='prompts/hello', messages=[...])
except ValueError as e:
    if 'BitBucket configuration not found' in str(e):
        litellm.set_global_bitbucket_config({'workspace': 'ws', 'repository': 'repo', 'access_token': 'x'})
        resp = litellm.completion(model='bitbucket/gpt-4', prompt_id='prompts/hello', messages=[...])
    else:
        raise

Prevention

When it happens

Trigger: Adding 'bitbucket' to callbacks (SDK: litellm.callbacks = ['bitbucket']; proxy: litellm_settings.callbacks) without calling set_global_bitbucket_config first; proxy config placing global_bitbucket_config in the wrong section or misspelling the key; calling completion(model='bitbucket/gpt-4', prompt_id=...) in a fresh process that never set the global.

Common situations: Using the bitbucket prompt-management integration from its README but skipping step 3 (set global config); proxy deployments where the litellm_settings block is restructured and the key is lost; multiple workers where only one sets the global.

Related errors


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

Appendix: source

Thrown at litellm/litellm_core_utils/litellm_logging.py:4333

                if isinstance(callback, DotpromptManager):
                    return callback

            dotprompt_logger: Final = DotpromptManager()
            _in_memory_loggers.append(dotprompt_logger)
            return dotprompt_logger
        elif logging_integration == "bitbucket":
            from litellm.integrations.bitbucket.bitbucket_prompt_manager import (
                BitBucketPromptManager,
            )

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

            # Get global BitBucket config
            bitbucket_config: Final = getattr(litellm, "global_bitbucket_config", None)
            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.")

View on GitHub (pinned to 77b7c6c40c)