BerriAI/litellm · error · NotImplementedError
GoogleAIStudioFilesHandler does not support file content…
Error message
GoogleAIStudioFilesHandler does not support file content retrieval
What it means
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.
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
Example fix
# before
content = litellm.file_content(file_id='files/abc123', custom_llm_provider='gemini', api_key=KEY)
# NotImplementedError: ...does not support file content retrieval
# after - keep the source bytes; Gemini files are inputs, not storage
def upload_and_keep(path: str):
data = open(path, 'rb').read()
obj = litellm.create_file(file=data, custom_llm_provider='gemini', api_key=KEY)
my_store[obj.id] = data # serve content from your own store
return obj Defensive patterns
Strategy: fallback
Validate before calling
def can_download(provider: str) -> bool:
return provider != 'gemini' # content retrieval unsupported by the gemini handler Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- GoogleAIStudioFilesHandler does not support file listing
- Error parsing file delete response
- Error parsing file retrieve response
- Error parsing file upload response
- Failed to delete file
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/1c22e00b338f9401.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/gemini/files/transformation.py:388
litellm_params: dict,
) -> tuple[str, dict]:
raise NotImplementedError("GoogleAIStudioFilesHandler does not support file listing")
def transform_list_files_response(
self,
raw_response: httpx.Response,
logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
) -> list[OpenAIFileObject]:
raise NotImplementedError("GoogleAIStudioFilesHandler does not support file listing")
def transform_file_content_request(
self,
file_content_request,
optional_params: dict,
litellm_params: dict,
) -> tuple[str, dict]:
raise NotImplementedError("GoogleAIStudioFilesHandler does not support file content retrieval")
def transform_file_content_response(
self,
raw_response: httpx.Response,
logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
) -> HttpxBinaryResponseContent:
raise NotImplementedError("GoogleAIStudioFilesHandler does not support file content retrieval")
View on GitHub (pinned to 77b7c6c40c)