{"record":{"id":"e847a81d77c8a626","repo":"BerriAI/litellm","slug":"failed-to-get-repository-info-e","errorCode":null,"errorMessage":"Failed to get repository info: {e}","messagePattern":"Failed to get repository info: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/bitbucket/bitbucket_client.py","lineNumber":179,"sourceCode":"                    raise Exception(f\"Failed to list files in '{directory_path}': {e}\")\n            else:\n                raise Exception(f\"Error listing files in '{directory_path}': {e}\")\n\n    def get_repository_info(self) -> dict[str, Any]:\n        \"\"\"\n        Get information about the repository.\n\n        Returns:\n            Dictionary containing repository information\n        \"\"\"\n        url: Final = f\"{self.base_url}/repositories/{self.workspace}/{self.repository}\"\n\n        try:\n            response: Final = self.http_handler.get(url, headers=self.headers)\n            response.raise_for_status()\n            return response.json()\n        except Exception as e:\n            raise Exception(f\"Failed to get repository info: {e}\")\n\n    def test_connection(self) -> bool:\n        \"\"\"\n        Test the connection to the BitBucket repository.\n\n        Returns:\n            True if connection is successful, False otherwise\n        \"\"\"\n        try:\n            self.get_repository_info()\n            return True\n        except Exception:\n            return False\n\n    def get_branches(self) -> list[dict[str, Any]]:\n        \"\"\"\n        Get list of branches in the repository.\n","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/bitbucket/bitbucket_client.py#L161-L197","documentation":"Raised by BitBucketClient.get_repository_info when ANY exception occurs during GET /repositories/{workspace}/{repository} — unlike list_files, this method has no per-status handling, so 404 (wrong workspace/repo slug), 401 (bad credentials), 403 (insufficient permissions), rate limits, and network errors are all flattened into one generic message. Note that test_connection() swallows this exception and returns False instead.","triggerScenarios":"Calling get_repository_info (or test_connection) with a workspace or repository slug that does not exist (404), a revoked or expired access token (401), a token whose scope excludes the repository (403), a renamed repository, or during a network-level failure.","commonSituations":"Using a BitBucket app password with the default auth_method='token' (Bearer header) instead of auth_method='basic' with a username; workspace UUID vs slug confusion; repository renamed after config was written; rotated tokens not updated in the LiteLLM proxy env.","solutions":["Call test_connection() first to get a boolean isolation of the problem, then get_repository_info() to see the wrapped cause","If using an app password, set auth_method='basic' and username in the client config (app passwords do not work as Bearer tokens)","Verify workspace and repository slugs by opening https://bitbucket.org/<workspace>/<repository>/repo/settings in a browser","Regenerate/refresh the access token and confirm it has repository read scope"],"exampleFix":"// before\nconfig = {\"workspace\": \"acme\", \"repository\": \"prompts\", \"access_token\": APP_PASSWORD}\n\n// after\nconfig = {\n    \"workspace\": \"acme\",\n    \"repository\": \"prompts\",\n    \"access_token\": APP_PASSWORD,\n    \"auth_method\": \"basic\",\n    \"username\": \"dev@acme.com\",\n}","handlingStrategy":"validation","validationCode":"client = BitBucketClient(config)\nif not client.test_connection():\n    raise RuntimeError(\n        \"BitBucket unreachable/unauthorized: check workspace, repository, token, \"\n        \"and auth_method (app passwords need auth_method='basic' + username)\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    info = client.get_repository_info()\nexcept Exception as e:\n    # message flattens 401/403/404/network — re-fetch with curl to pinpoint\n    raise RuntimeError(f\"repository info failed: {e}\") from e","preventionTips":["Call test_connection() at startup and fail fast with a clear message","Use auth_method='basic' plus username when authenticating with a BitBucket app password","Store workspace/repository slugs exactly as they appear in the BitBucket URL","Automate token rotation checks (curl /2.0/user) so expiry is caught before requests"],"tags":["bitbucket","http","authentication","repository-config"],"backgroundTag":"http-request-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}