{"record":{"id":"aa1bde7648cc48e7","repo":"BerriAI/litellm","slug":"error-getting-file-metadata-for-file-path-e","errorCode":null,"errorMessage":"Error getting file metadata for '{file_path}': {e}","messagePattern":"Error getting file metadata for '(.+?)': (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/bitbucket/bitbucket_client.py","lineNumber":245,"sourceCode":"            headers: Final = self.headers.copy()\n            headers[\"Range\"] = \"bytes=0-0\"  # Request only first byte to get headers\n\n            response: Final = self.http_handler.get(url, headers=headers)\n            response.raise_for_status()\n\n            return {\n                \"content_type\": response.headers.get(\"content-type\"),\n                \"content_length\": response.headers.get(\"content-length\"),\n                \"last_modified\": response.headers.get(\"last-modified\"),\n            }\n        except Exception as e:\n            # Check if it's an HTTP error\n            if hasattr(e, \"response\") and hasattr(e.response, \"status_code\"):\n                if e.response.status_code == 404:\n                    return None\n                raise Exception(f\"Failed to get file metadata for '{file_path}': {e}\")\n            else:\n                raise Exception(f\"Error getting file metadata for '{file_path}': {e}\")\n\n    def close(self):\n        \"\"\"Close the HTTP handler to free resources.\"\"\"\n        if hasattr(self, \"http_handler\"):\n            self.http_handler.close()\n","sourceCodeStart":227,"sourceCodeEnd":251,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/bitbucket/bitbucket_client.py#L227-L251","documentation":"Raised by BitBucketClient.get_file_metadata when the exception has no HTTP status_code attribute — the request never completed at the HTTP layer. This is the connection-level branch: DNS failures, TCP refusals, TLS handshake errors, and timeouts from the shared HTTPHandler, distinct from sibling branch [303] which handles real HTTP responses.","triggerScenarios":"Calling get_file_metadata when api.bitbucket.org (or a custom base_url) is unreachable: DNS resolution failure, firewall/proxy blocking egress, SSL verification error from corporate certificate inspection, or client timeout before a response arrives.","commonSituations":"Containers with broken DNS or no egress to api.bitbucket.org; corporate SSL-inspection proxies without a trusted CA in the container; wrong custom base_url for BitBucket Data Center deployments.","solutions":["Confirm basic reachability from the same host: curl -I \"https://api.bitbucket.org/2.0/repositories/<ws>/<repo>/src/main/<file>\" -H \"Authorization: Bearer $TOKEN\"","Fix proxy/CA configuration (HTTPS_PROXY, SSL_CERT_FILE) when running in corporate networks","Correct or remove the custom base_url in the client config","Treat as transient: retry the metadata call with backoff before failing hard"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import httpx\n\ndef can_reach_bitbucket() -> bool:\n    try:\n        httpx.head(\"https://api.bitbucket.org/2.0\", timeout=5.0)\n        return True\n    except httpx.RequestError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    meta = client.get_file_metadata(path)\nexcept Exception as e:\n    if str(e).startswith(\"Error getting file metadata\"):\n        ...  # connection-level: DNS/TLS/proxy — check env, then retry once\n    else:\n        raise","preventionTips":["Ensure egress to api.bitbucket.org (or your Data Center host) is allowed in the network policy","Mount the corporate CA bundle when behind TLS inspection","Verify custom base_url values in config before deploying"],"tags":["bitbucket","network","file-metadata","timeout"],"backgroundTag":"network-connectivity-error","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}