Firebase AI (Gemini Flash) throwing DECODE_PREEMPTED and UNAVAILABLE errors during Android app image analysis
I am developing an Android application using Firebase AI and the Gemini Flash model for image analysis. Recently, the app has started failing intermittently with the following errors in the Firebase console:
UNAVAILABLE
DECODE_PREEMPTED ("Preempted out of decode queue by a higher priority request")
INTERNAL ("This model is currently experiencing high demand.")
Additional Context:
This workflow and application were working completely fine previously without any code changes on my end.
The issue happens across multiple circuit/substation images, so it's not specific to a single corrupt image file.
I am currently on the Free Tier (Spark Plan).
My Questions:
Is this a known Google-side backend capacity issue or regional load problem with Gemini Flash?
Do requests failing with DECODE_PREEMPTED count against the Free Tier daily request quota?
Are there any best practices or recommended retry strategies in Android/Firebase to handle this gracefully?