AI Analysis
#9 Gemini Model Fallback Hell: 404, 429, Deprecated Models, and the Final Chain
· Build Log
A production fallback strategy for model deprecation, quota limits, and unstable availability.
Gemini fallback chainmodel deprecation429 handling
1) TL;DR
- Single-model dependency repeatedly failed under deprecation and quota pressure.
- Errors included 404 invalid model, 429 rate limit, and empty outputs.
- A prioritized fallback chain and validation gate stabilized generation.
2) What I Tried
I started with one preferred model and optimistic retries.
3) What Broke
Popup/news generation failed unpredictably across action runs.
4) Root Cause
Model lifecycle and quota behavior require ordered fallback chains, not single-point retries.
5) Before (Code Path)
scripts/generate-hot-news-infographic.mjs
- narrow model selection
- limited error classification
- weak output validation
6) After (Code Path)
scripts/generate-hot-news-infographic.mjs
+ ordered model chain
+ explicit 400/404/429/5xx handling
+ output quality gate before commit/archive
7) Evidence (Git History)
- 4b701f5 fix(gemini): remove non-existent model and fix 429 fallback logic.
- 97ff6bd fix(news): add gemini-2.5-flash-lite/flash to top fallback chain.
- 6a08876 fix(popup): runtime model discovery with v1 and v1beta chain.
8) What I Learned
Fallback strategy must be designed as product logic, not emergency patchwork.
9) Frequently Asked Questions
Why not lock one premium model?
Availability and quota events can still fail hard in automation windows.
What is the critical safeguard?
Block publication when generated output fails validation.
What improved user-side?
Far fewer empty popup-generation runs.