I need help so I don't lose another project. / Sorry, I hit a snag. Please try again shortly or modify your prompt.

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:streamGenerateContent?alt=sse: [400 Bad Request] The input token count (1052033) exceeds the maximum number of tokens allowed (1048576).

Is there any way to avoid this error?

I’ve had to restart my project from scratch three times. Even trying temporary solutions didn’t last.

One possible solution I’m trying is to create a new workspace by importing the already created and functional project. However, when importing, the icon for changing prototypes with AI doesn’t appear.

Does anyone have any ideas for solving this type of problem? If it’s necessary to recreate the project, what precautions I should take, or if I should choose a pre-made template?

Looking at the error message you provided it says that you’re exceeding the input token count by ~3500 tokens. To avoid this error, you will need to shorten your input.

If your input is small, your context history might be large. You can use the prompt /clear to empty your prompt history. This can be helpful if you get stuck on a previous instruction or if you want to move to a completely new task without the context of your prior discussion. It does not change any of your project files.

From what I’m analyzing, I think the problem is the app’s context. I’ve tried /clear and still haven’t gotten any results.

In one of my apps, which I lost due to the same error, I cleared the context. Although I didn’t lose the page content, it’s practically impossible to continue development because of the hallucinations.

I don’t know much about programming, but I was wondering if there’s a way to add a file with the app’s functional context so that when I need to clear the history, I won’t be so lost.

Perhaps I could keep a context with the paths and settings already made, and another file with a more “disposable” context.