{"record":{"id":"1c22e00b338f9401","repo":"BerriAI/litellm","slug":"googleaistudiofileshandler-does-not-support-file-c","errorCode":null,"errorMessage":"GoogleAIStudioFilesHandler does not support file content retrieval","messagePattern":"GoogleAIStudioFilesHandler does not support file content retrieval","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/gemini/files/transformation.py","lineNumber":388,"sourceCode":"        litellm_params: dict,\n    ) -> tuple[str, dict]:\n        raise NotImplementedError(\"GoogleAIStudioFilesHandler does not support file listing\")\n\n    def transform_list_files_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n        litellm_params: dict,\n    ) -> list[OpenAIFileObject]:\n        raise NotImplementedError(\"GoogleAIStudioFilesHandler does not support file listing\")\n\n    def transform_file_content_request(\n        self,\n        file_content_request,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> tuple[str, dict]:\n        raise NotImplementedError(\"GoogleAIStudioFilesHandler does not support file content retrieval\")\n\n    def transform_file_content_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n        litellm_params: dict,\n    ) -> HttpxBinaryResponseContent:\n        raise NotImplementedError(\"GoogleAIStudioFilesHandler does not support file content retrieval\")\n","sourceCodeStart":370,"sourceCodeEnd":397,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/gemini/files/transformation.py#L370-L397","documentation":"GoogleAIStudioFilesHandler.transform_file_content_request raises NotImplementedError: downloading raw file content through LiteLLM's file-content interface is not implemented for the Gemini provider. The handler only supports create (two-step resumable upload), retrieve metadata, and delete.","triggerScenarios":"Calling litellm.file_content / the files handler's content-download path with custom_llm_provider='gemini' — e.g. trying to fetch bytes of a previously uploaded Gemini file through the OpenAI-style API.","commonSituations":"Apps that mirror user uploads back to clients via the same abstraction used to upload; debugging workflows that dump file contents; assuming full OpenAI Files API parity for Gemini.","solutions":["Store the original bytes locally (or in your own object storage) at upload time instead of re-downloading from Gemini","For content you own, re-fetch from your source of truth rather than the Gemini Files API","If you must download, check whether Google's Files API supports :download for your file type and call it directly with the x-goog-api-key header","Open an upstream feature request with BerriAI/litellm"],"exampleFix":"# before\ncontent = litellm.file_content(file_id='files/abc123', custom_llm_provider='gemini', api_key=KEY)\n# NotImplementedError: ...does not support file content retrieval\n\n# after - keep the source bytes; Gemini files are inputs, not storage\ndef upload_and_keep(path: str):\n    data = open(path, 'rb').read()\n    obj = litellm.create_file(file=data, custom_llm_provider='gemini', api_key=KEY)\n    my_store[obj.id] = data  # serve content from your own store\n    return obj","handlingStrategy":"fallback","validationCode":"def can_download(provider: str) -> bool:\n    return provider != 'gemini'  # content retrieval unsupported by the gemini handler","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat Gemini uploads as one-way inputs: keep the authoritative bytes in your own storage","Branch file-content flows per provider instead of assuming a uniform files API","Add NotImplementedError to the expected-exception list in cross-provider files tests"],"tags":["gemini","files-api","not-implemented","file-download"],"backgroundTag":"unsupported-operation","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}