{"record":{"id":"38f0d4e391f9462d","repo":"BerriAI/litellm","slug":"mavvrik-focus-destination-gcs-session-init-missin","errorCode":null,"errorMessage":"Mavvrik FOCUS destination: GCS session init missing Location header","messagePattern":"Mavvrik FOCUS destination: GCS session init missing Location header","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":195,"sourceCode":"        metadata: Final = b'{\"contentEncoding\":\"gzip\",\"contentDisposition\":\"attachment\"}'\n        init_resp: Final = await self._http.client.request(\n            method=\"POST\",\n            url=signed_url,\n            headers={\n                \"Content-Type\": \"application/gzip\",\n                \"x-goog-resumable\": \"start\",\n            },\n            content=metadata,\n            timeout=30.0,\n        )\n        if init_resp.status_code not in (200, 201):\n            raise RuntimeError(\n                f\"Mavvrik FOCUS destination: GCS session init failed ({init_resp.status_code}): {init_resp.text[:400]}\"\n            )\n\n        session_uri: Final = init_resp.headers.get(\"Location\")\n        if not session_uri:\n            raise RuntimeError(\"Mavvrik FOCUS destination: GCS session init missing Location header\")\n        _validate_gcs_url(session_uri, \"session URI\")\n\n        verbose_logger.debug(\n            \"Mavvrik FOCUS destination: GCS session started, uploading %d gzip bytes in %d chunk(s)\",\n            total,\n            max(1, -(-total // _GCS_CHUNK_SIZE)),  # ceiling division\n        )\n\n        # Step 2: upload in chunks; cancel session on any failure to avoid\n        # lingering GCS sessions (they stay open for ~1 week otherwise).\n        offset = 0\n        try:\n            while offset < total:\n                chunk = gzip_bytes[offset : offset + _GCS_CHUNK_SIZE]\n                chunk_end = offset + len(chunk) - 1\n                is_final = (offset + len(chunk)) >= total\n                content_range = f\"bytes {offset}-{chunk_end}/{total}\" if is_final else f\"bytes {offset}-{chunk_end}/*\"\n                expected_statuses = {200, 201} if is_final else {308}","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/mavvrik_destination.py#L177-L213","documentation":"RuntimeError raised when GCS answers the resumable-session init with 200/201 but the response carries no Location header. The Location header holds the session URI used for every subsequent chunk PUT; without it the resumable protocol cannot proceed. Extremely rare against real GCS — usually an intermediary on the network path strips or renames the header.","triggerScenarios":"A corporate proxy, API gateway, or service mesh between litellm and storage.googleapis.com removes the Location header on the init response; the destination then aborts before uploading any chunks.","commonSituations":"Egress proxies with header allowlists, misconfigured Envoy/NGINX intermediaries, TLS-inspecting middleboxes, or security appliances rewriting redirect-style headers.","solutions":["Reproduce outside the proxy (curl -i on a session-init request) to confirm the header is stripped in transit","Configure the proxy/gateway to pass the Location response header through unmodified","If it reproduces with a direct connection, gather the response headers and report to Mavvrik/litellm maintainers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await destination.deliver(content=content, time_window=tw, filename=fn)\nexcept RuntimeError as e:\n    if \"missing Location header\" in str(e):\n        logger.error(\"Network path strips the GCS Location header; check egress proxy config: %s\", e)\n        raise\n    raise","preventionTips":["Ensure egress proxies/gateways pass the Location response header through unmodified","Test the resumable-upload path (not just connectivity) from inside the production network","Document required response headers for storage.googleapis.com in proxy config"],"tags":["gcs","resumable-upload","proxy","http-headers"],"backgroundTag":"missing-response-header","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}