BerriAI/litellm · error · ValueError

MAVVRIK_API_ENDPOINT host must be a Mavvrik domain

Error message

MAVVRIK_API_ENDPOINT host must be a Mavvrik domain (e.g. https://api.mavvrik.dev/<tenant_id>)

What it means

ValueError raised when the hostname of MAVVRIK_API_ENDPOINT does not end with one of the allowlisted suffixes .mavvrik.dev, .mavvrik.ai, or .mavvrik.app. Because the x-api-key credential is sent to whatever host the endpoint names, this allowlist stops the key from being transmitted to an arbitrary server. Checked after the HTTPS check, still at construction time.

Solutions

  1. Use the canonical endpoint https://api.mavvrik.dev/<tenant_id> (or another *.mavvrik.dev/.ai/.app host from your Mavvrik onboarding)
  2. Check for typos and for the missing subdomain (apex 'mavvrik.dev' is rejected)
  3. For local mocks, add a DNS/hosts entry under a .mavvrik.dev subdomain that points at your mock

Example fix

# before
MAVVRIK_API_ENDPOINT=https://mavvrik.dev/acme

# after
MAVVRIK_API_ENDPOINT=https://api.mavvrik.dev/acme
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse

host = (urlparse(os.getenv("MAVVRIK_API_ENDPOINT", "")).hostname or "").lower()
if not any(host.endswith(s) for s in (".mavvrik.dev", ".mavvrik.ai", ".mavvrik.app")):
    raise SystemExit(f"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain, got: {host!r}")

Type guard

from urllib.parse import urlparse

_MAVVRIK_SUFFIXES = (".mavvrik.dev", ".mavvrik.ai", ".mavvrik.app")

def is_mavvrik_host(url: str) -> bool:
    """True when url is https and its host is on the Mavvrik allowlist."""
    if not url.startswith("https://"):
        return False
    host = (urlparse(url).hostname or "").lower()
    return any(host.endswith(s) for s in _MAVVRIK_SUFFIXES)

Try / catch

try:
    destination = FocusMavvrikDestination(prefix="focus", config=cfg)
except ValueError as e:
    raise SystemExit(f"Mavvrik endpoint rejected: {e}") from e

Prevention

When it happens

Trigger: api_endpoint hostnames like 'api.example.com', 'mavvrik.dev' (bare apex: does not end with '.mavvrik.dev'), 'localhost:8080', or any non-Mavvrik domain, passed via config or the MAVVRIK_API_ENDPOINT env var.

Common situations: Domain typos (mavvrik.io, mavrik.dev), corporate proxy domains, pointing the destination at a local mock server for integration tests, or internal staging environments not hosted under the allowed suffixes.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/2504be3c2fd57a33. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/focus/destinations/mavvrik_destination.py:36

    get_async_httpx_client,
    httpxSpecialProvider,
)

from .base import FocusDestination, FocusTimeWindow

_MAVVRIK_ALLOWED_SUFFIXES: Final = (".mavvrik.dev", ".mavvrik.ai", ".mavvrik.app")

# 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."""

View on GitHub (pinned to 77b7c6c40c)