Gemini (using 1.5 flash) suddenly throwing invalid error argument for prompts with file uri input

I’m uploading a video with GoogleAIFileManager, then passing it into generateContent after it is active. Essentially following code from their guide.

This has previously worked fine, but today I randomly get the following error for requests:

GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [400 Bad Request] Request contains an invalid argument.

Relevant chunk of code looks like this:

    const file = await this.uploadFileToGoogle(video_url, mime_type);
    if (!file) return null;

    await this.waitForFileActive(file);

    const result = await this.model.generateContent([
      {
        fileData: {
          mimeType: file.mimeType,
          fileUri: file.uri,
        },
      },
      {
        text: prompt,
      },
    ]);

I have tried omitting the “video part” of the content array so that I’m only sending the prompt, and this works. I have also tried using an obviously incorrect file uri, and this results in a different error (invalid uri).

Curious if anybody else is experiencing the same issue. Seems like it may be an issue with Google’s API if I haven’t missed anything here.

Update: I tried switching the model and so far I don’t get this error with gemini-1.5-pro and gemini-1.5-flash-8b. The issue seems to be specifically with 1.5-flash.

3 Likes

Using, this documentation, I had no issue with gemini-1.5-pro but encountered your error with `gemini-1.5-flash and different versions of it. Let me further into this and get back to you.

1 Like

Same issue for my use case:

curl “https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?key=[our api key]”
-H ‘Content-Type: application/json’
-d ‘{ “system_instruction”: {
“parts”:
{ “text”: “You are a cat. Your name is Neko.”}},
“contents”: {
“parts”: {
“text”: “Hello there”}}}’
[{
“error”: {
“code”: 400,
“message”: “Developer instruction is not enabled for models/gemini-1.5-flash”,
“status”: “INVALID_ARGUMENT”
}
}
]%

I’m getting an error too:

[GoogleGenerativeAI Error]: Error fetching from
https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:streamGenerateContent?alt=sse
: [400 Bad Request] Invalid resource field value in the request. [{“@type”:“type.googleapis.com/google.rpc.ErrorInfo",“reason”:“RESOURCE_PROJECT_INVALID”,“domain”:“googleapis.com”,“metadata”:{“service”:“aiplatform.googleapis.com”,“method”:"google.cloud.aiplatform.internal.PredictionService.StreamGenerateContent”}}]

1 Like

I’m getting the same RESOURCE_PROJECT_INVALID error with gemini-1.5-flash:streamGenerateContent
generateContent is working fine, as is gemini-2.0-flash-exp

No code changes…

1 Like

I’m also getting this error:

Error buildAgentGraph - Error: [GoogleGenerativeAI Error]: Error fetching from
https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:streamGenerateContent?alt=sse
: [400 Bad Request] Function calling is not enabled for models/gemini-1.5-flash-latest

I am also encountering the same error in my environment.

Run failed: [google] Bad Request Error, 400 Invalid resource field value in the request. [reason: “RESOURCE_PROJECT_INVALID”
domain: “googleapis.com
metadata {
key: “service”
value: “aiplatform.googleapis.com
}
metadata {
key: “method”
value: “google.cloud.aiplatform.internal.PredictionService.StreamGenerateContent”
}
]

Hey @camadi any update on this and when it might be resolved?

1 Like

Hey folks, looking into this, trying to get a simple code snippet to reproduce this right now.

3 Likes

Hello everyone. This is issue has been reported to the product team and I will provide updates once they respond. Thank you for your patience.
@Logan_Kilpatrick You can reproduce the issue by following this Prompt with a video and text example, using gemini-1.5-flash model.

2 Likes

Hi Logan,

You can also reproduce it with this curl command:

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?key=[API KEY]" \
-H 'Content-Type: application/json' \
-d '{ "system_instruction": {"parts":{ "text": "You are a cat. Your name is Neko."}},"contents": {"parts": {"text": "Hello there"}}}'

This gives the following error:

[{
  "error": {
    "code": 400,
    "message": "Developer instruction is not enabled for models/gemini-1.5-flash",
    "status": "INVALID_ARGUMENT"
  }
}
]

It started happening yesterday (1/8/2025) at around 10am pacific. It doesn’t seem to affect everyone’s account, so you might have to cycle through some different API keys to see it.

Hey folks, we’ve pushed a fix for both the video uploads via the File API and the streamGenerateContent issues, and they should be live soon. Please let us know if you continue to experience these problems

4 Likes

The issue (related to video uploads) is fixed on my end. Thanks everyone! :grin:

1 Like