Help :( Sudden constant Error code 500 (Internal Error) with the Gemini API in my Android app

Hello! Today, I’ve suddenly been having this error constantly, across Google Accounts and API keys when using the Gemini API through my Android app. It was working perfectly fine the last few days.
I’m using the free API, and I was planning to pay for it but I’m having second thoughts now.

Error: Unexpected Response:

"error": {
"code": 500,
"message": "An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting",
"status": "INTERNAL"

kotlinx. serialization. MissingFieldException: Field 'details' is required for type with serial name 'com.google.ai.client.generativeai.common.server. GRpcError', but it was missing at path: $.error

The following is my model initialisation code. Is it because I’m doing something wrong here?

        Content systemInstructionsContent = new Content.Builder()
                .addText(systemInstructions)
                .build();


        GenerativeModel gm = new GenerativeModel(
                "gemini-1.5-pro",
                apiKey,
                null,
                null,
                new RequestOptions(), // Use default RequestOptions
                null,
                null,
                systemInstructionsContent
        );

I’m leaving some of the parameters as null, as I want them at the default and only want to add a system prompt.
I’m using Java to call the model from my Android app!

Thanks so so much for the help!

1 Like

Same for me . Using flutter with above package. iOS and android. Free tier

1 Like

Welcome to the forum!

We’re seeing an increase in 500 errors, and showing us some of this code helps a LOT!

Can you reproduce this with a minimal example?
Exactly what is the call you’re making that triggers the error?

Today working better, not constantly 500. Looks like limits per minutes increased a bit . Will adjust my code. When I calling model, I calling “gemini-1.5-pro-latest” now as well.

нету разниц что gemini-1.5-pro-latest или gemini-1.5-pro. у меня сегодня стало лучше работать :blush: