BerriAI/litellm · error · ValueError
Mavvrik FOCUS destination
Error message
Mavvrik FOCUS destination: {label} must be HTTPS, got scheme '{parsed.scheme}' What it means
ValueError from _validate_gcs_url when a URL the destination is about to upload to is not HTTPS: either the signed URL returned by Mavvrik's upload-url endpoint or the resumable-session URI from GCS. It is a runtime guard against a misbehaving or tampered Mavvrik response sending your billing data (CSV) over plaintext, and it fires before any upload bytes are transmitted.
Solutions
- Reproduce manually: curl -s "$MAVVRIK_API_ENDPOINT/metrics/agent/ai/$MAVVRIK_CONNECTION_ID/upload-url?name=2026-01-01&type=metrics&datetime=2026-01-01" -H "x-api-key: $MAVVRIK_API_KEY" and inspect the returned url scheme
- If a proxy rewrites redirects/URLs, configure it to preserve https
- If the real Mavvrik API returns http signed URLs, report it to Mavvrik and pin/upgrade litellm once fixed
Defensive patterns
Strategy: try-catch
Type guard
from urllib.parse import urlparse
def is_https_url(url: str) -> bool:
"""True when the Mavvrik-returned URL is safe to upload to."""
return urlparse(url).scheme == "https" Try / catch
try:
await destination.deliver(content=content, time_window=tw, filename=fn)
except ValueError as e:
if "must be HTTPS" in str(e):
# Response-side integrity failure: log loudly and do not retry unchanged
logger.error("Mavvrik returned a non-HTTPS upload URL; possible proxy tampering: %s", e)
raise Prevention
- Configure egress proxies to preserve https on responses from the Mavvrik API
- Monitor for this error specifically — it indicates a tampered or changed upstream response, not a config mistake
- Keep litellm updated so allowlist/validation changes track the Mavvrik API
When it happens
Trigger: During deliver(): Mavvrik's GET /metrics/agent/ai/{connection_id}/upload-url returns a 'url' field whose scheme is http://, or the GCS resumable-init response's Location header is an http:// URI. Both then raise immediately.
Common situations: Mavvrik API contract change, an intermediary proxy or TLS-terminating middlebox rewriting URLs to http, or a stub/mock Mavvrik server in tests returning http URLs.
Related errors
- Mavvrik FOCUS destination
- MAVVRIK_API_ENDPOINT host must be a Mavvrik domain
- MAVVRIK_API_ENDPOINT must be an HTTPS URL
- Mavvrik FOCUS destination: GCS chunk upload failed
- Mavvrik FOCUS destination: GCS session init failed
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/10566a36bc5ac009.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/focus/destinations/mavvrik_destination.py:44
# GCS requires intermediate chunks to be a multiple of 256 KB.
# 8 MB gives a good balance between round-trips and memory pressure.
_GCS_CHUNK_SIZE: Final = 8 * 1024 * 1024 # 8 MB
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")View on GitHub (pinned to 77b7c6c40c)