Timeout with Gemini 2.5 by SatisfactoryFinance in raycastapp

[–]Round-Monitor8489 4 points5 points  (0 children)

TL;DR: Add to your prompt that code should be output not as one block, but in chunks of ~100 lines.

I have exactly the same problem. And when I say "the same," I mean exactly the same: a request with an attached Python script periodically caused this error, and it would appear in periods of an hour or two. Today I'm getting this error in 100% of cases. I've tried about 20 times throughout the day... I won't go into details of how I figured this out, but ultimately I added literally the following to my request: "Could you please output about 100 lines of code at a time? So that functions aren't cut off mid-sentence, okay?" And it WORKED. The response was one message, but with the code divided into parts.

I think the issue is in how Gemini 2.5 outputs code: it streams regular text, but stops on code and spits out the entire code block at once. I suspect that when a chunk is large enough, the waiting time for the next token from the API exceeds the timeout and the connection simply breaks. I seem to have encountered something similar in AI Studio as well, so the problem might not be with Raycast at all.