BerriAI/litellm · error · RuntimeError
Mavvrik FOCUS destination: failed to update metricsMarker
Error message
Mavvrik FOCUS destination: failed to update metricsMarker ({resp.status_code}): {resp.text[:200]} What it means
RuntimeError raised when PATCH /metrics/agent/ai/{connection_id} with {'metricsMarker': date_epoch} returns any >=400 status (other than 410) after a successful GCS upload. The export data is safe in the bucket, but Mavvrik's catch-up watermark is not advanced, so subsequent runs may re-deliver that date. The message embeds the status and first 200 chars of the body.
Solutions
- Retry the export run — re-uploading the same date overwrites the same GCS object, so the retry is idempotent
- 401/403 -> refresh MAVVRIK_API_KEY before the next run
- Persistent 400 -> upgrade litellm for an updated PATCH contract or report the body snippet to Mavvrik
Defensive patterns
Strategy: retry
Try / catch
import asyncio, re
async def deliver_with_retry(destination, *, content, time_window, filename, attempts=3):
for i in range(attempts):
try:
await destination.deliver(content=content, time_window=time_window, filename=filename)
return
except RuntimeError as e:
if "failed to update metricsMarker" not in str(e):
raise
m = re.search(r"\((\d+)\)", str(e))
status = int(m.group(1)) if m else 0
if i < attempts - 1 and (status >= 500 or status == 429):
await asyncio.sleep(2**i)
continue
raise Prevention
- Treat metricsMarker failures as retryable: the GCS object write is idempotent for the same date
- Rotate MAVVRIK_API_KEY promptly when 401/403 appears in the embedded status
- Monitor for repeated marker failures on the same date — it indicates a contract or auth problem, not transiency
When it happens
Trigger: Transient 5xx at marker-update time immediately after an upload, 401/403 if the API key was revoked mid-session, or 400 if the PATCH body contract changed on Mavvrik's side.
Common situations: A Mavvrik blip right after upload completes, key rotation during a long backfill, API version drift between litellm and Mavvrik.
Related errors
- Mavvrik FOCUS destination: failed to get signed URL
- Mavvrik FOCUS destination: register failed
- MAVVRIK_FOCUS_FREQUENCY=
- api_key must be provided for Vantage destination (set…
- BFL initial request failed
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/c26831a2c74bcae0.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/focus/destinations/mavvrik_destination.py:262
raise
async def _update_metrics_marker(self, date_epoch: int) -> None:
"""PATCH agent endpoint to advance metricsMarker after a successful upload."""
resp: Final = await self._http.client.request(
method="PATCH",
url=self._agent_url,
headers=self._auth_headers,
json={"metricsMarker": date_epoch},
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: failed to update metricsMarker ({resp.status_code}): {resp.text[:200]}"
)
verbose_logger.debug("Mavvrik FOCUS destination: metricsMarker advanced to %s", date_epoch)
async def get_metrics_marker(self) -> int | None:
"""Register with Mavvrik and return the current metricsMarker.
Always calls the Mavvrik register API — unlike deliver() which skips
registration once _registered is True, catch-up requires a fresh
marker value on every run.
"""
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,
)View on GitHub (pinned to 77b7c6c40c)