BerriAI/litellm · error · ValueError
workspace, repository, and access_token are required
Error message
workspace, repository, and access_token are required
What it means
BitBucketClient's constructor requires the config keys workspace, repository and access_token; if any is missing or empty (falsy) it raises before any HTTP request. Note a latent quirk in this code: base_url is read from the key "" (empty string), so a base_url you put in the dict is silently ignored and the public api.bitbucket.org endpoint is always used.
Solutions
- Include all three required keys with non-empty values: workspace, repository, access_token
- For app-password auth also set auth_method="basic" and username (token auth with Bearer is the default)
- Log config.keys() (never values) before construction to catch typos early
- If a custom base_url (BitBucket Server/Data Center) is needed, note the current code ignores it — patch or subclass until fixed
Example fix
// before
BitBucketClient({"workspace": "acme", "repository": "prompt-library"})
// after
BitBucketClient({
"workspace": "acme",
"repository": "prompt-library",
"access_token": os.environ["BITBUCKET_APP_PASSWORD"],
"auth_method": "basic",
"username": "svc-prompts",
}) Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = ("workspace", "repository", "access_token")
missing = [k for k in REQUIRED if not config.get(k)]
if missing:
raise ValueError(f"bitbucket config missing required keys: {missing}")
client = BitBucketClient(config) Type guard
def is_complete_bitbucket_config(config: dict) -> bool:
return isinstance(config, dict) and all(
isinstance(config.get(k), str) and config.get(k) for k in
("workspace", "repository", "access_token")
) Prevention
- Validate the three keys before constructing the client; empty strings count as missing
- Watch for key typos — 'repo', 'token', 'accessToken' all silently fail
- Note base_url is read from the "" key (upstream bug): a base_url entry is ignored, so don't rely on it
- Load the token from env/vault and .strip() it before inserting
When it happens
Trigger: Constructing the client from a partial dict ({"workspace": "acme"} only); typo'd keys such as 'repo' or 'token'; YAML/env-derived config where unset keys become None; passing the bitbucket_config through but with empty-string values from an unfilled template.
Common situations: Config templating that only fills some placeholders; renaming keys during a refactor; secrets resolved from vault that return None and are inserted as-is.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- BitBucket configuration not found. Please set…
- 503
- Access denied to directory
- Access denied to file
- All values in argilla_transformation_object must be a key…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/d359d491eaa18121.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/bitbucket/bitbucket_client.py:57
config: Dictionary containing:
- workspace: BitBucket workspace name
- repository: Repository name
- access_token: BitBucket access token (or app password)
- branch: Branch to fetch from (default: main)
- base_url: Custom BitBucket API base URL (optional)
- auth_method: Authentication method ('token' or 'basic', default: 'token')
- username: Username for basic auth (optional)
"""
self.workspace = config.get("workspace")
self.repository = config.get("repository")
self.access_token = config.get("access_token")
self.branch = config.get("branch", "main")
self.base_url = config.get("", "https://api.bitbucket.org/2.0")
self.auth_method = config.get("auth_method", "token")
self.username = config.get("username")
if not all([self.workspace, self.repository, self.access_token]):
raise ValueError("workspace, repository, and access_token are required")
# Set up authentication headers
self.headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
if self.auth_method == "basic" and self.username:
# Use basic auth with username and app password
credentials: Final = f"{self.username}:{self.access_token}"
encoded_credentials: Final = base64.b64encode(credentials.encode()).decode()
self.headers["Authorization"] = f"Basic {encoded_credentials}"
else:
# Use token-based authentication (default)
self.headers["Authorization"] = f"Bearer {self.access_token}"
# Initialize HTTPHandler
self.http_handler = HTTPHandler()View on GitHub (pinned to 77b7c6c40c)