# Firebase Studio “hits a snag” - constantly

**URL:** <https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155>\
**Category:** Gemini API\
**Tags:** issues, help\
**Created:** [June 16, 2025, 4:59am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155 "2025-06-16T04:59:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuedasyi123](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/xuedasyi123/32/55664_2.png) [@xuedasyi123](https://discuss.ai.google.dev/u/xuedasyi123)\
**Post date:** [June 16, 2025, 4:59am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/1 "2025-06-16T04:59:50Z")

</div>

I am developing a project in Firebase Studio. When I talk to Gemini AI, I get an AI error. I don’t know how to solve it?

“

 ![image](https://d3qe71uytubmmx.cloudfront.net/original/3X/8/c/8c0f648646994530335eb4bb3a5c851bda2be802.png)

Sorry, I hit a snag. Please try again shortly or modify your prompt.

[GoogleGenerativeAI Error]: Error fetching from [https://monospace-pa.googleapis.com/v1/models/gemini-2.5-pro-preview-03-25:streamGenerateContent?alt=sse:](https://monospace-pa.googleapis.com/v1/models/gemini-2.5-pro-preview-03-25:streamGenerateContent?alt=sse:) [400 Bad Request] The input token count (10138605) exceeds the maximum number of tokens allowed (1048576).  
”  
Processing: image.png…

---

<div class="post-metadata">

**Author:** ![Lalit\_Kumar](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/lalit_kumar/32/37058_2.png) [@Lalit\_Kumar](https://discuss.ai.google.dev/u/Lalit_Kumar)\
**Post date:** [June 16, 2025, 11:21am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/3 "2025-06-16T11:21:34Z")

</div>

Hello,

Welcome to the Forum!

It seems that you have reached the maximum number of allowed tokens. I would recommend you to go through [Firebase documentation](https://firebase.google.com/docs), this will help you gain detailed information.

---

<div class="post-metadata">

**Author:** ![Affiloom\_SaaS](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/affiloom_saas/32/55923_2.png) [@Affiloom\_SaaS](https://discuss.ai.google.dev/u/Affiloom_SaaS)\
**Post date:** [June 16, 2025, 12:15pm UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/4 "2025-06-16T12:15:58Z")

</div>

i got the same problem, when does this limit reset ? isn’t it there any solutions ? can’t i put my own api key and pay for what i use ?

---

<div class="post-metadata">

**Author:** ![Lalit\_Kumar](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/lalit_kumar/32/37058_2.png) [@Lalit\_Kumar](https://discuss.ai.google.dev/u/Lalit_Kumar)\
**Post date:** [June 17, 2025, 6:39am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/6 "2025-06-17T06:39:57Z")

</div>

Hello,

Welcome to the Forum!

I would recommend you to go through [Firebase documentation](https://firebase.google.com/docs).

---

<div class="post-metadata">

**Author:** ![TheLucator](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/thelucator/32/58289_2.png) [@TheLucator](https://discuss.ai.google.dev/u/TheLucator)\
**Post date:** [July 10, 2025, 3:46am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/8 "2025-07-10T03:46:49Z")

</div>

Your error is due to the total number of tokens that Gemini is trying to process in Firebase Studio exceeding the allowed limit (1,048,576 tokens). This can happen if your request is too long or if the app you’re developing includes a lot of files or embedded data.

It’s not a bug, nor have you hit a daily limit or anything like that. It’s simply that your project (or what you’re sending to the model) is loading more than 1 million tokens, which goes beyond what Gemini can handle in a single request.

The same thing happened to me: in my case, the website had many files (some encoded in base64) directly included in the project, which caused the token count to skyrocket.

✅ Quick fix: Try deleting unnecessary files or create a `.aiexclude` file in the root of the project to prevent Gemini from loading heavy folders like `node_modules/`, `.next/`, `dist/`, etc.

---

<div class="post-metadata">

**Author:** ![xuedasyi123](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/xuedasyi123/32/55664_2.png) [@xuedasyi123](https://discuss.ai.google.dev/u/xuedasyi123)\
**Post date:** [July 12, 2025, 6:08pm UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/10 "2025-07-12T18:08:46Z")

</div>

Thank you, the problem is finally solved, thank you for your solution.

TheLucator via Google AI Developers Forum ‘_Modified by moderator_’

---

<div class="post-metadata">

**Author:** ![emre\_aksel](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/emre_aksel/32/59461_2.png) [@emre\_aksel](https://discuss.ai.google.dev/u/emre_aksel)\
**Post date:** [July 25, 2025, 4:04am UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/12 "2025-07-25T04:04:13Z")

</div>

In my case, the application was reading many json files to visualize the data, the problem was solved when I deleted the big ones according to your answer.

---

<div class="post-metadata">

**Author:** ![Alreadycoolz](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/alreadycoolz/32/69177_2.png) [@Alreadycoolz](https://discuss.ai.google.dev/u/Alreadycoolz)\
**Post date:** [October 24, 2025, 11:09pm UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/14 "2025-10-24T23:09:01Z")

</div>

I have the same problem right now. Since I don’t know much about programming, I don’t really know which files to delete, and I don’t want to mess up my project. Can anyone who is an expert tell me which files to delete to stop the “hits a snag” error? Thanks! I will attach an image of my explorer; please tell me which folders I should check. I will try to respond as soon as possible.

 ![Screenshot 2025-10-24 160647](https://d3qe71uytubmmx.cloudfront.net/original/3X/3/b/3bf4e94cb64b022f59974ff8c14b52183b60eda4.png)

---

<div class="post-metadata">

**Author:** ![armchairtycoon](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/armchairtycoon/32/99033_2.png) [@armchairtycoon](https://discuss.ai.google.dev/u/armchairtycoon)\
**Post date:** [February 27, 2026, 8:32pm UTC](https://discuss.ai.google.dev/t/firebase-studio-hits-a-snag-constantly/89155/16 "2026-02-27T20:32:23Z")

</div>

thank you. this worked
