BerriAI/litellm · error · RuntimeError
Mavvrik FOCUS destination: register failed
Error message
Mavvrik FOCUS destination: register failed ({resp.status_code}): {resp.text[:200]} What it means
RuntimeError wrapping any >=400 response other than 410 from POST /metrics/agent/ai/{connection_id} during registration at the start of deliver(). Registration initializes the connector and returns the metricsMarker used for catch-up; the message embeds the status code and first 200 characters of the Mavvrik response body for diagnosis.
Solutions
- Read the embedded status: 401/403 -> generate a fresh API key in Mavvrik and update MAVVRIK_API_KEY
- 404 -> verify MAVVRIK_CONNECTION_ID exists and api_endpoint includes the tenant path (https://api.mavvrik.dev/<tenant_id>)
- 5xx -> retry on the next export cycle; the FOCUS logger backfills missed dates
Defensive patterns
Strategy: try-catch
Validate before calling
async def mavvrik_register_ok(api_endpoint: str, api_key: str, connection_id: str) -> tuple[bool, str]:
"""Probe registration; returns (ok, body) for the caller to branch on."""
resp = await httpx.AsyncClient().request(
method="POST",
url=f"{api_endpoint}/metrics/agent/ai/{connection_id}",
headers={"Content-Type": "application/json", "x-api-key": api_key},
json={"name": connection_id},
timeout=30.0,
)
return resp.status_code < 400, resp.text[:200] Try / catch
try:
await destination.deliver(content=content, time_window=tw, filename=fn)
except RuntimeError as e:
msg = str(e)
if "register failed (401)" in msg or "register failed (403)" in msg:
rotate_mavvrik_api_key() # permanent auth failure
raise
if "register failed (5" in msg or "register failed (429)" in msg:
schedule_retry(backoff="next_cycle") # transient
return
raise Prevention
- Parse the embedded status code from the message to branch: 4xx-credentials -> fix config, 5xx/429 -> retry
- Keep API keys in a rotation workflow so revocations update the env quickly
- Verify connection_id and tenant path whenever registration starts failing suddenly
When it happens
Trigger: 401/403 when MAVVRIK_API_KEY is invalid, expired, or revoked; 404 when connection_id is wrong or the tenant path in api_endpoint does not match; 429/5xx during Mavvrik rate limiting or an outage — each at the first deliver() call of an export run.
Common situations: Rotated API keys not updated in the deployment, a connection_id typo, the tenant segment missing from MAVVRIK_API_ENDPOINT (wrong URL → 404), or a Mavvrik-side incident.
Related errors
- Mavvrik FOCUS destination: failed to get signed URL
- Mavvrik FOCUS destination: failed to update metricsMarker
- BFL initial request failed
- MAVVRIK_FOCUS_FREQUENCY=
- api_key must be provided for Vantage destination (set…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/f721d0c3827d0aab.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/focus/destinations/mavvrik_destination.py:128
Returns None if the connector was already registered (cached).
"""
if self._registered:
return None
resp: Final = await self._http.client.request(
method="POST",
url=self._agent_url,
headers=self._auth_headers,
json={"name": self.connection_id},
timeout=30.0,
)
if resp.status_code == 410:
self._registered = False
raise RuntimeError(
"Mavvrik FOCUS destination: connector is disconnected (410). "
"Re-enable the connection in the Mavvrik dashboard."
)
if resp.status_code >= 400:
raise RuntimeError(f"Mavvrik FOCUS destination: register failed ({resp.status_code}): {resp.text[:200]}")
self._registered = True
metrics_marker: Final = resp.json().get("metricsMarker", 0)
verbose_logger.debug(
"Mavvrik FOCUS destination: connector registered (metricsMarker=%s)",
metrics_marker,
)
return metrics_marker
async def _get_signed_url(self, date_str: str) -> str:
"""GET upload-url endpoint → GCS signed URL for the given date."""
params: Final = {"name": date_str, "type": "metrics", "datetime": date_str}
resp: Final = await self._http.client.request(
method="GET",
url=self._upload_url_endpoint,
headers=self._auth_headers,
params=params,
timeout=30.0,
)View on GitHub (pinned to 77b7c6c40c)