BerriAI/litellm · error · ValueError

MAVVRIK_API_ENDPOINT must be provided for Mavvrik FOCUS…

Error message

MAVVRIK_API_ENDPOINT must be provided for Mavvrik FOCUS destination (set MAVVRIK_API_ENDPOINT env var or pass in destination_config)

What it means

ValueError raised in FocusMavvrikDestination.__init__ when the resolved config has no truthy 'api_endpoint'. The endpoint (e.g. https://api.mavvrik.dev/<tenant_id>) is the base for the agent registration, upload-url, and metricsMarker calls. Resolved from destination_config['api_endpoint'] or MAVVRIK_API_ENDPOINT; checked after the api_key check, still at construction time.

Solutions

  1. Set the tenant-scoped endpoint: export MAVVRIK_API_ENDPOINT=https://api.mavvrik.dev/<tenant_id>
  2. Or pass it in config: config={'api_endpoint': 'https://api.mavvrik.dev/<tenant_id>', ...}
  3. Copy the exact value from the Mavvrik connector setup page (it includes the tenant path)

Example fix

# before
export MAVVRIK_API_KEY=mk_live_xxx
# MAVVRIK_API_ENDPOINT missing

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

Strategy: validation

Validate before calling

import os

api_endpoint = (config or {}).get("api_endpoint") or os.getenv("MAVVRIK_API_ENDPOINT")
if not api_endpoint:
    raise SystemExit("MAVVRIK_API_ENDPOINT is required (env var or destination_config['api_endpoint'])")

Type guard

import os
from typing import Any

def has_mavvrik_endpoint(config: dict[str, Any] | None) -> bool:
    """True when a Mavvrik API endpoint is resolvable."""
    return bool((config or {}).get("api_endpoint") or os.getenv("MAVVRIK_API_ENDPOINT"))

Try / catch

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

Prevention

When it happens

Trigger: Enabling the Mavvrik FOCUS destination with MAVVRIK_API_ENDPOINT unset and no api_endpoint in the config dict (None or empty string), while MAVVRIK_API_KEY is present.

Common situations: Only the API key was added to the deployment env, the tenant-scoped endpoint from Mavvrik onboarding was never copied, or the var was set in a different shell/environment than the one running the export.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

    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")

        if not api_key:
            raise ValueError(
                "MAVVRIK_API_KEY must be provided for Mavvrik FOCUS destination "
                "(set MAVVRIK_API_KEY env var or pass in destination_config)"
            )
        if not api_endpoint:
            raise ValueError(
                "MAVVRIK_API_ENDPOINT must be provided for Mavvrik FOCUS destination "
                "(set MAVVRIK_API_ENDPOINT env var or pass in destination_config)"
            )
        if not connection_id:
            raise ValueError(
                "MAVVRIK_CONNECTION_ID must be provided for Mavvrik FOCUS destination "
                "(set MAVVRIK_CONNECTION_ID env var or pass in destination_config)"
            )

        _validate_api_endpoint(api_endpoint)

        self.api_key = api_key
        self.api_endpoint = api_endpoint.rstrip("/")
        self.connection_id = connection_id
        self.prefix = prefix
        self._http: AsyncHTTPHandler = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)
        self._registered = False

View on GitHub (pinned to 77b7c6c40c)