BerriAI/litellm · error · ValueError
Mavvrik FOCUS destination
Error message
Mavvrik FOCUS destination: {label} must be a GCS endpoint (storage.googleapis.com), got '{hostname}' What it means
ValueError from _validate_gcs_url when the hostname of the Mavvrik-provided signed URL or the GCS resumable-session URI is not storage.googleapis.com (or a *.storage.googleapis.com subdomain). This is an SSRF/exfiltration guard: upload traffic containing your FOCUS cost data may only be sent to genuine GCS endpoints. Fires at runtime, before any upload.
Solutions
- Verify with curl what host the upload-url endpoint actually returns; if it is no longer storage.googleapis.com, Mavvrik changed their contract — upgrade litellm for a matching allowlist update
- Check whether a corporate proxy or DNS interception is altering the response
- If you operate the Mavvrik side, ensure upload URLs are issued for storage.googleapis.com
Defensive patterns
Strategy: try-catch
Type guard
from urllib.parse import urlparse
def is_gcs_upload_url(url: str) -> bool:
"""True when url targets storage.googleapis.com over https."""
p = urlparse(url)
host = (p.hostname or "").lower()
return p.scheme == "https" and (host == "storage.googleapis.com" or host.endswith(".storage.googleapis.com")) Try / catch
try:
await destination.deliver(content=content, time_window=tw, filename=fn)
except ValueError as e:
if "must be a GCS endpoint" in str(e):
logger.error("Mavvrik returned a non-GCS upload URL; verify proxy integrity and Mavvrik API version: %s", e)
raise
raise Prevention
- Do not bypass or monkeypatch _validate_gcs_url — it prevents billing-data exfiltration
- Verify Mavvrik API compatibility when upgrading either side
- Investigate any occurrence: it means the upstream response named an unexpected host
When it happens
Trigger: During deliver(): the upload-url endpoint returns a url pointing at another host (e.g. an S3 endpoint or internal domain), or the resumable-init Location header names an unexpected host — the destination raises instead of PUTting data there.
Common situations: Mavvrik changing its storage provider or API shape, a tampered/hijacked response, new regional GCS hostnames not covered by the allowlist, or a mock server returning non-GCS URLs.
Related errors
- MAVVRIK_API_ENDPOINT host must be a Mavvrik domain
- Mavvrik FOCUS destination
- Mavvrik FOCUS destination: GCS chunk upload failed
- Mavvrik FOCUS destination: GCS session init failed
- URL targets a blocked address
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/72a10bd1392bd14a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/focus/destinations/mavvrik_destination.py:47
def _validate_api_endpoint(api_endpoint: str) -> None:
if not api_endpoint.startswith("https://"):
raise ValueError("MAVVRIK_API_ENDPOINT must be an HTTPS URL")
hostname: Final = (urlparse(api_endpoint).hostname or "").lower()
if not any(hostname.endswith(suffix) for suffix in _MAVVRIK_ALLOWED_SUFFIXES):
raise ValueError(
"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain (e.g. https://api.mavvrik.dev/<tenant_id>)"
)
def _validate_gcs_url(url: str, label: str) -> None:
parsed: Final = urlparse(url)
if parsed.scheme != "https":
raise ValueError(f"Mavvrik FOCUS destination: {label} must be HTTPS, got scheme '{parsed.scheme}'")
hostname: Final = (parsed.hostname or "").lower()
if not (hostname == "storage.googleapis.com" or hostname.endswith(".storage.googleapis.com")):
raise ValueError(
f"Mavvrik FOCUS destination: {label} must be a GCS endpoint (storage.googleapis.com), got '{hostname}'"
)
class FocusMavvrikDestination(FocusDestination):
"""Upload FOCUS CSV exports to Mavvrik via GCS signed URL."""
def __init__(
self,
*,
prefix: str,
config: dict[str, Any] | None = None,
) -> None:
config = config or {}
api_key: Final = config.get("api_key")
api_endpoint: Final = config.get("api_endpoint")
connection_id: Final = config.get("connection_id")
View on GitHub (pinned to 77b7c6c40c)