{"record":{"id":"d359d491eaa18121","repo":"BerriAI/litellm","slug":"workspace-repository-and-access-token-are-requir","errorCode":null,"errorMessage":"workspace, repository, and access_token are required","messagePattern":"workspace, repository, and access_token are required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/bitbucket/bitbucket_client.py","lineNumber":57,"sourceCode":"            config: Dictionary containing:\n                - workspace: BitBucket workspace name\n                - repository: Repository name\n                - access_token: BitBucket access token (or app password)\n                - branch: Branch to fetch from (default: main)\n                - base_url: Custom BitBucket API base URL (optional)\n                - auth_method: Authentication method ('token' or 'basic', default: 'token')\n                - username: Username for basic auth (optional)\n        \"\"\"\n        self.workspace = config.get(\"workspace\")\n        self.repository = config.get(\"repository\")\n        self.access_token = config.get(\"access_token\")\n        self.branch = config.get(\"branch\", \"main\")\n        self.base_url = config.get(\"\", \"https://api.bitbucket.org/2.0\")\n        self.auth_method = config.get(\"auth_method\", \"token\")\n        self.username = config.get(\"username\")\n\n        if not all([self.workspace, self.repository, self.access_token]):\n            raise ValueError(\"workspace, repository, and access_token are required\")\n\n        # Set up authentication headers\n        self.headers = {\n            \"Accept\": \"application/json\",\n            \"Content-Type\": \"application/json\",\n        }\n\n        if self.auth_method == \"basic\" and self.username:\n            # Use basic auth with username and app password\n            credentials: Final = f\"{self.username}:{self.access_token}\"\n            encoded_credentials: Final = base64.b64encode(credentials.encode()).decode()\n            self.headers[\"Authorization\"] = f\"Basic {encoded_credentials}\"\n        else:\n            # Use token-based authentication (default)\n            self.headers[\"Authorization\"] = f\"Bearer {self.access_token}\"\n\n        # Initialize HTTPHandler\n        self.http_handler = HTTPHandler()","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/bitbucket/bitbucket_client.py#L39-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"Config templating that only fills some placeholders; renaming keys during a refactor; secrets resolved from vault that return None and are inserted as-is.","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"],"exampleFix":"// before\nBitBucketClient({\"workspace\": \"acme\", \"repository\": \"prompt-library\"})\n// after\nBitBucketClient({\n    \"workspace\": \"acme\",\n    \"repository\": \"prompt-library\",\n    \"access_token\": os.environ[\"BITBUCKET_APP_PASSWORD\"],\n    \"auth_method\": \"basic\",\n    \"username\": \"svc-prompts\",\n})","handlingStrategy":"validation","validationCode":"REQUIRED = (\"workspace\", \"repository\", \"access_token\")\nmissing = [k for k in REQUIRED if not config.get(k)]\nif missing:\n    raise ValueError(f\"bitbucket config missing required keys: {missing}\")\nclient = BitBucketClient(config)","typeGuard":"def is_complete_bitbucket_config(config: dict) -> bool:\n    return isinstance(config, dict) and all(\n        isinstance(config.get(k), str) and config.get(k) for k in\n        (\"workspace\", \"repository\", \"access_token\")\n    )","tryCatchPattern":null,"preventionTips":["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"],"tags":["bitbucket","configuration","missing-credentials","client-init"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}