Gemini in Firebase Studio throwing token limit error even on simple inputs

I’m running into a strange issue in Firebase Studio using Gemini (Genkit / GoogleGenerativeAI).

Even when I send a very simple input like “hi”, I get this error:


[GoogleGenerativeAI Error]:
Error fetching from https://monospace-pa.googleapis.com/v1/models/gemini-3-flash-preview:streamGenerateContent?alt=sse:
[400 Bad Request] The input token count exceeds the maximum number of tokens allowed 1048576

What I’ve noticed:

  • Happens even with very small prompts (e.g. “hi”)

  • No explicit large context is being passed in my code

  • Using Firebase Studio / Gemini inside workspace

  • Seems like hidden context is being included automatically

What I’ve tried:

  • Restarting the workspace

  • Starting a new chat session

  • Checking my code for large prompts (nothing obvious)

Question:

Is there a known issue where Firebase Studio or Genkit automatically injects large workspace context that can exceed token limits? And how can I reset or limit that context?

Any help would be appreciated.

this issue still not fixed yet, i’m also experiencing it

After interaction with support team of Firebase they told me these things as showing in screenshot regarding token limit. May, it help you.

Yes, I tried this, it worked but I still notice that the prototype mode gemini still shows the same error but if i’m in the code view the gemini there works but looks like it makes a lot of mistakes, i think i’ll just try to upgrade the gemini version and see . thanks

There is reason behind it.

In Code mode the gemini work as a limited context it read the only necessary files to update where in prototyper mode the system made such that it send the entire project at once as a system prompt some times it reaches the ai context or left limited token for ai which made ai to do only limited change instead of its full capacity to do.

Basically as you can understand that it is just api call and response system, where ai have limited hard context window of 1M to do changes or under. If input context windows is bigger, then it is normally the output context window will small.

Thanks