BerriAI/litellm · error · Exception
Error getting file metadata for
Error message
Error getting file metadata for '{file_path}': {e} What it means
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.
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
Defensive patterns
Strategy: try-catch
Validate before calling
import httpx
def can_reach_bitbucket() -> bool:
try:
httpx.head("https://api.bitbucket.org/2.0", timeout=5.0)
return True
except httpx.RequestError:
return False Try / catch
try:
meta = client.get_file_metadata(path)
except Exception as e:
if str(e).startswith("Error getting file metadata"):
... # connection-level: DNS/TLS/proxy — check env, then retry once
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- BedrockException: Timeout Error
- Cisco AI Defense API call timed out after s
- Error fetching file
- Error fetching prompt version
- Error listing files in
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/aa1bde7648cc48e7.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/bitbucket/bitbucket_client.py:245
headers: Final = self.headers.copy()
headers["Range"] = "bytes=0-0" # Request only first byte to get headers
response: Final = self.http_handler.get(url, headers=headers)
response.raise_for_status()
return {
"content_type": response.headers.get("content-type"),
"content_length": response.headers.get("content-length"),
"last_modified": response.headers.get("last-modified"),
}
except Exception as e:
# Check if it's an HTTP error
if hasattr(e, "response") and hasattr(e.response, "status_code"):
if e.response.status_code == 404:
return None
raise Exception(f"Failed to get file metadata for '{file_path}': {e}")
else:
raise Exception(f"Error getting file metadata for '{file_path}': {e}")
def close(self):
"""Close the HTTP handler to free resources."""
if hasattr(self, "http_handler"):
self.http_handler.close()
View on GitHub (pinned to 77b7c6c40c)