BerriAI/litellm · error · RuntimeError

Mavvrik FOCUS destination: response missing 'url' field

Error message

Mavvrik FOCUS destination: response missing 'url' field: {resp.json()}

What it means

RuntimeError raised when the upload-url endpoint answers 2xx but its JSON body has no 'url' field. The destination expects {'url': '<GCS signed URL>'}; any other shape means the API contract changed or an unexpected payload (e.g. an error object or proxy page) came back with a success status. The full response JSON is embedded in the message.

Solutions

  1. Upgrade litellm to the latest release in case the Mavvrik contract change was already adapted to
  2. Log the embedded response body to see exactly what replaced the url field
  3. Reproduce with curl against the upload-url endpoint to confirm the payload shape and report to Mavvrik if the field is genuinely missing
Defensive patterns

Strategy: try-catch

Try / catch

try:
    await destination.deliver(content=content, time_window=tw, filename=fn)
except RuntimeError as e:
    if "missing 'url' field" in str(e):
        # Contract drift or proxy interference — surface for triage, do not blind-retry
        logger.error("Mavvrik upload-url response shape changed: %s", e)
        open_ticket("mavvrik-api-contract", str(e))
        raise
    raise

Prevention

When it happens

Trigger: Mavvrik ships an API version that renames the field or returns {'error': ...} alongside HTTP 200; a corporate proxy returns its own JSON with 200; a stub server in tests returns an incomplete body.

Common situations: litellm version out of sync with a changed Mavvrik API, middleware injecting responses, partial service degradation returning soft errors.

Related errors


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

Appendix: source

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

        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,
        )
        if resp.status_code >= 400:
            raise RuntimeError(
                f"Mavvrik FOCUS destination: failed to get signed URL ({resp.status_code}): {resp.text[:200]}"
            )
        signed_url: Final = resp.json().get("url")
        if not signed_url:
            raise RuntimeError(f"Mavvrik FOCUS destination: response missing 'url' field: {resp.json()}")
        _validate_gcs_url(signed_url, "signed URL")
        verbose_logger.debug("Mavvrik FOCUS destination: got signed URL for date %s", date_str)
        return signed_url

    async def _upload_to_gcs(self, signed_url: str, content: bytes) -> None:
        """Upload gzip-compressed CSV to GCS via chunked resumable upload.

        The full CSV is gzip-compressed first, then uploaded in _GCS_CHUNK_SIZE
        chunks using the GCS resumable upload protocol. GCS assembles the chunks
        server-side into a single complete object — the bucket receives one file
        regardless of how many chunks were sent.

        Intermediate chunks: Content-Range: bytes X-Y/*   → expect 308
        Final chunk:         Content-Range: bytes X-Y/T   → expect 200/201

        This handles exports larger than available memory for a single PUT while
        keeping the destination code self-contained (no changes to the FOCUS
        pipeline upstream).

View on GitHub (pinned to 77b7c6c40c)