[Resolved] 503 Error Code when using "gemini-2.5-flash-preview-04-17" at very low RPM

Hi fellow developers,

My name is Bo. I am a middle school science teacher in NYC who just started vibe coding. I am trying to create some tools for my students, but I need some help troubleshooting the high percentage of 503 errors.

What Happened

The webpage I made has a simple feature: provide feedback to students based on their answers. However, when I tested it out with my class today, I got a lot of 503 errors.


Blue: 200; Green: 503; purple: 500

During the 40 minutes, students were simultaneously using the Google Site page. They made a total of 442 requests, and the error rate is an astonishing 26%. Fyi, I embedded the html, css, javascript, and my exposed API key all together into a Google Site for easy access on Google Classroom.

My Question

The model I use is gemini-2.5-flash-preview-04-17. I switched my billing from free trial to paid tier 1 only yesterday, and I can see a few cents of cost incurred on Google Cloud dashboard. Can I assume I should be getting the 1,000 RPM rate limit?

I understand that the code is barebones and doesn’t handle much, but at such a low request rate, what’s causing the 503 errors?

Code Snippet

            const prompt = `
System Instruction: ${instruction}

Question Number: ${selectedQuestion["Question Number"]}
Question Type: ${selectedQuestion["Questions Type"]}
Provided Context:
${selectedQuestion["Provided Context"]}

Question:
${selectedQuestion.Question}

Answer Key:
${selectedQuestion["Answer Key"]}

Student's Answer:
${studentAnswer}

Feedback:
`;

           try {
                const stream = await ai.models.generateContentStream({
                  model: 'gemini-2.5-flash-preview-04-17', // Or your preferred model
                  contents: [{role: "user", parts: [{text: prompt}]}],
                });

                let currentFeedback = "";
                feedbackTextEl.textContent = ""; // Clear "Getting feedback... May take up to 10 seconds..."
                for await (const chunk of stream) {
                  if (chunk.text) {
                    currentFeedback += chunk.text;
                    feedbackTextEl.innerHTML = marked.parse(currentFeedback);
                  }
                }
            } catch (error) {
                console.error("Error getting feedback:", error);
                feedbackTextEl.innerHTML = marked.parse("Sorry, an error occurred while getting feedback. Please try again.");
            }
        }

Hey @Bo_Y - I believe this was caused by an incident we had earlier today (Google AI Studio). This issue should be resolved now! Let me know if you continue to run into any issues

2 Likes