{"record":{"id":"b7d282ab176d6ee2","repo":"BerriAI/litellm","slug":"error-fetching-file-element-response-status-co","errorCode":null,"errorMessage":"Error fetching file {element}: {response.status_code} {response.text}","messagePattern":"Error fetching file (.+?): (.+?) (.+?)","errorType":"http","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py","lineNumber":73,"sourceCode":"        Args:\n            input: GeminiEmbeddingInput that may contain file references\n            api_key: Gemini API key\n            sync_handler: HTTP client\n\n        Returns:\n            Dict mapping file name to {mime_type, uri}\n        \"\"\"\n        input_list: Final = [input] if isinstance(input, str) else input\n        resolved_files: Final[dict[str, dict[str, str]]] = {}\n\n        for element in input_list:\n            if isinstance(element, str) and _is_file_reference(element):\n                url = f\"https://generativelanguage.googleapis.com/v1beta/{element}\"\n                headers = {\"x-goog-api-key\": api_key}\n                response = sync_handler.get(url=url, headers=headers)\n\n                if response.status_code != 200:\n                    raise Exception(f\"Error fetching file {element}: {response.status_code} {response.text}\")\n\n                file_data = response.json()\n                resolved_files[element] = {\n                    \"mime_type\": file_data.get(\"mimeType\", \"\"),\n                    \"uri\": file_data.get(\"uri\", element),\n                }\n\n        return resolved_files\n\n    async def _async_resolve_file_references(\n        self,\n        input: GeminiEmbeddingInput,\n        api_key: str,\n        async_handler: AsyncHTTPHandler,\n    ) -> dict[str, dict[str, str]]:\n        \"\"\"\n        Async version of _resolve_file_references.\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py#L55-L91","documentation":"Raised while resolving file references for Gemini batch embeddings: GETting a referenced file (e.g. files/... under generativelanguage.googleapis.com) returned non-200, and the status plus body are embedded. Fires when an input element references a file that is missing or inaccessible.","triggerScenarios":"Triggered when fetching a file element for Gemini batch embedding returns a non-success status.","commonSituations":"See trigger scenarios.","solutions":["Inspect the status/text for the file fetch failure.","Verify the Gemini file reference and API key permissions."],"exampleFix":"# confirm the files/... reference exists via the Gemini files API.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}