{"record":{"id":"c26831a2c74bcae0","repo":"BerriAI/litellm","slug":"mavvrik-focus-destination-failed-to-update-metric","errorCode":null,"errorMessage":"Mavvrik FOCUS destination: failed to update metricsMarker ({resp.status_code}): {resp.text[:200]}","messagePattern":"Mavvrik FOCUS destination: failed to update metricsMarker \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":262,"sourceCode":"            raise\n\n    async def _update_metrics_marker(self, date_epoch: int) -> None:\n        \"\"\"PATCH agent endpoint to advance metricsMarker after a successful upload.\"\"\"\n        resp: Final = await self._http.client.request(\n            method=\"PATCH\",\n            url=self._agent_url,\n            headers=self._auth_headers,\n            json={\"metricsMarker\": date_epoch},\n            timeout=30.0,\n        )\n        if resp.status_code == 410:\n            self._registered = False\n            raise RuntimeError(\n                \"Mavvrik FOCUS destination: connector is disconnected (410). \"\n                \"Re-enable the connection in the Mavvrik dashboard.\"\n            )\n        if resp.status_code >= 400:\n            raise RuntimeError(\n                f\"Mavvrik FOCUS destination: failed to update metricsMarker ({resp.status_code}): {resp.text[:200]}\"\n            )\n        verbose_logger.debug(\"Mavvrik FOCUS destination: metricsMarker advanced to %s\", date_epoch)\n\n    async def get_metrics_marker(self) -> int | None:\n        \"\"\"Register with Mavvrik and return the current metricsMarker.\n\n        Always calls the Mavvrik register API — unlike deliver() which skips\n        registration once _registered is True, catch-up requires a fresh\n        marker value on every run.\n        \"\"\"\n        resp: Final = await self._http.client.request(\n            method=\"POST\",\n            url=self._agent_url,\n            headers=self._auth_headers,\n            json={\"name\": self.connection_id},\n            timeout=30.0,\n        )","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/focus/destinations/mavvrik_destination.py#L244-L280","documentation":"Raised when the PATCH to the Mavvrik agent endpoint that advances metricsMarker returns any HTTP >= 400 other than 410. metricsMarker is Mavvrik's high-water mark for catch-up exports; failing to advance it means the next run will re-export the same window. The response body (first 200 chars) is included to identify the cause.","triggerScenarios":"PATCH {agent_url} with json={\"metricsMarker\": date_epoch} returns 400/401/403/404/429/5xx — bad auth headers, expired token, rate limiting, or a Mavvrik-side incident.","commonSituations":"Expired or rotated Mavvrik API credentials; wrong agent URL in config; Mavvrik API outage; 429 rate limiting when many windows export in quick succession during catch-up.","solutions":["Inspect the logged status code and response snippet: 401/403 → fix credentials; 429 → back off and retry; 5xx → retry later.","Re-run the export — since the marker did not advance, the same window is re-exported with no data loss (idempotent by design).","Verify the agent URL and auth headers in the Mavvrik destination config."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        await export_once()\n        break\n    except RuntimeError as e:\n        if \"failed to update metricsMarker\" in str(e) and attempt < 2:\n            await asyncio.sleep(2 ** attempt * 30)\n            continue\n        raise","preventionTips":["Rely on metricsMarker semantics: a failed marker update means the next run re-exports idempotently.","Exponential backoff on 429/5xx marker updates; fix credentials on 401/403 instead of retrying.","Log resp.status_code and body snippet (already embedded) into your alerting pipeline."],"tags":["mavvrik","focus-export","http-error","metrics-marker"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}