FileSearch problem with generateContent and some API Keys

Hi,
I’m trying the “File Search” APIs .

Everything seems to be working fine (create, upload, delete, etc.).

However, when I try to make a simple request (you can see a simple example below) I have a weird problem:

• With an old API KEY (created in 2025, before Google AI Studio) everything works fine.
• With all API KEYs created in recent weeks (in Google AI Studio) however it doesn’t work

The problem is that a “generateContent” call remains in “pending” state, while all other CRUD operations work.

When i switch to the old ( 2025) key it works fine :pleading_face:

Of course I have already compared the keys in the Cloud Console and they are configured in the same way. I also tried API keys with no restrictions or adding some restrictins.

No recent API KEYs can get this call to work (while they work with any other Gemini API so I’m sure it’s valid).



  await ai.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: 'Prompt here...',
    config: {
       tools: [
        {
          fileSearch: {
            fileSearchStoreNames: [             
              'fileSearchStores/xyz',
            ],
          }
        }
      ],
      
    }
  })

Thank you

Hi @Fabio_Biondi, welcome to the community!

Can you please check if the key which is newly generated is under the same project or a different one?

Unless you specifically created it under your project, when you generate a new key, it often creates a new project and associates the key with it. API Keys

Thank you!

Hi @Srikanta_K_N , thank you for your answer.
The new API key (that doesn’t work) has been created with a different project than the old key (that work).

However I used the same new key to create the SearchSTore file (and this operation works) while searching with generateContent doesn’t work.

It’s also strange that the old key API ALWAYS works, also on new FileStores that I didn’t create with it (while none of the new keys work)

UPDATE: I also asked to a friend to create an API key (with no restrictions) with its own GCP ENTERPRISE and it has the same problem: generateContent remains in pending state