Skip to content

TypeError: Missing required parameter "ragStoreName" when using genai.upload_file #752

@Hank-CH-Chang

Description

@Hank-CH-Chang

Description of the bug:

When calling the standard genai.upload_file() function to upload a media file (e.g., an MP4 video), the underlying API client library throws a TypeError. This occurs on macOS with Python 3.9 installed via pyenv.

Environment:

OS: macOS
Python: 3.9 (via pyenv)
Library Versions:
google-generativeai: 0.8.5
google-ai-generativelanguage: 0.6.15
google-api-python-client: 2.184.0
google-api-core: 2.26.0
google-auth: 2.41.1
Minimal Reproducible Code: (You can attach the bug_report_repro.py file I created for you)

bug_report_repro.py

Actual vs expected behavior:

Actual Behavior: The call to genai.upload_file() fails with a TypeError, asking for a ragStoreName parameter, which is unrelated to the File API. The following traceback is produced:
Traceback (most recent call last):
File "/path/to/your/script.py", line 31, in
media_file = genai.upload_file(path=file_path, mime_type=mime_type)
File "/path/to/your/myenv/lib/python3.9/site-packages/google/generativeai/files.py", line 85, in upload_file
response = client.create_file(
File "/path/to/your/myenv/lib/python3.9/site-packages/google/generativeai/client.py", line 120, in create_file
request = self._local.discovery_api.media().upload(body={"file": file}, media_body=media)
File "/path/to/your/myenv/lib/python3.9/site-packages/googleapiclient/discovery.py", line 1114, in method
raise TypeError('Missing required parameter "%s"' % name)
TypeError: Missing required parameter "ragStoreName"

Expected Behavior: The genai.upload_file() function should successfully upload the file and return a google.generativeai.types.File object without errors, and without requiring parameters from the Corpus/RAG API.

Any other information you'd like to share?

The following debugging steps have been attempted but did not resolve the issue:

Upgraded Packages: Ran pip install --upgrade google-generativeai, but version 0.8.5 was already the latest available.
Cleared API Cache: Deleted the ~/.cache/google-api-python-client directory to force the API client to rebuild its discovery cache.
Explicitly Set MIME Type: Modified the call to genai.upload_file(path=..., mime_type=...) to rule out issues with automatic MIME type detection.
Checked Media File Integrity: Ensured the media file being uploaded was not empty or corrupted. The error occurs even with a valid, newly created file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions