{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/bitbucket/bitbucket_client.py#L161-L197","documentation":"Catch-all from BitBucketClient.get_repository_info: a GET to /2.0/repositories/{workspace}/{repo} either returned a non-2xx status (raise_for_status) or the response body failed to parse as JSON. All context is flattened into the message string. This method also backs test_connection(), so a failure here is what makes test_connection() return False.","triggerScenarios":"Calling get_repository_info() or test_connection() with a wrong workspace/repository slug (404), bad credentials (401), insufficient repository read scope (403), or when network access to api.bitbucket.org fails before a response arrives.","commonSituations":"Initial setup validation of the BitBucket prompt integration; repository renamed or transferred to another workspace so the slug goes stale; typos in the workspace/repository config keys.","solutions":["Use client.test_connection() first — it returns False instead of raising, letting you branch gracefully","Check workspace and repository slugs exactly match the BitBucket URL (bitbucket.org/{workspace}/{repository})","Confirm the token can read the repository via curl -H \"Authorization: Bearer $TOKEN\" https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}","Parse the embedded HTTP status from the message to distinguish auth (401/403) from not-found (404)"],"exampleFix":"# before\ninfo = client.get_repository_info()\n\n# after\nif not client.test_connection():\n    raise RuntimeError(\n        f\"Cannot reach BitBucket repo {client.workspace}/{client.repository}; \"\n        \"check slugs, token, and network egress\"\n    )\ninfo = client.get_repository_info()","handlingStrategy":"try-catch","validationCode":"if not client.test_connection():\n    raise RuntimeError(\"BitBucket repo unreachable; verify slugs, token, network\")","typeGuard":null,"tryCatchPattern":"try:\n    info = client.get_repository_info()\nexcept Exception as e:\n    msg = str(e)\n    if \"401\" in msg or \"403\" in msg:\n        fail_fast(\"credentials\")\n    elif \"404\" in msg:\n        fail_fast(\"workspace/repository slug wrong\")\n    else:\n        retry_or_alert(e)","preventionTips":["Run test_connection() in a startup readiness probe","Keep workspace/repository slugs in one config source of truth","Alert on repository rename/transfer events from BitBucket webhooks"],"tags":["bitbucket","api-client","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}