500 ERROR while send message with bytes or uri

Hello,

I’m trying to use the java-genai library (version 1.10.0), but I’m running into an error.

I was wondering if anyone has encountered this before or might know what’s wrong. Any help would be appreciated!

Error:

com.google.genai.errors.ServerException: 500 . An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting
	at com.google.genai.errors.ApiException.throwFromResponse(ApiException.java:96)
	at com.google.genai.HttpApiResponse.getBody(HttpApiResponse.java:37)
	at com.google.genai.Models.privateGenerateContent(Models.java:5810)
	at com.google.genai.Models.generateContent(Models.java:6690)
	at com.google.genai.Chat.privateSendMessage(Chat.java:145)
	at com.google.genai.Chat.sendMessage(Chat.java:102)
        ...

My Code:

    try (Client client = Client.builder().apiKey(apiKey).build()) {
      Chat chat = client.chats.create("gemini-2.5-pro");
      GenerateContentResponse response = chat.sendMessage(Content.fromParts(
          Part.fromBytes("{\"name\":\"Jay Song\"}".getBytes(), "application/json")
      ));

      return response.text();
    }

500 means Google service has some error ,retry or wait some minutes 。

I first tried this last week, and the same error is still occurring today.

this is google gemini API troubleshooting guide ,explore this page ,as you see


the 500 error means An unexpected error occurred on Google’s side.
change model to 2.5 flash ,if your application can work ,provide the question from google server。

both ‘gemini-2.5-pro’ and ‘gemini-2.5-flash’ not work

Is there anything wrong with the code?
If not, it seems there’s a problem with Google’s server. If that’s the case… I guess waiting might be the only answer.

I’ve sent feedback to Google, following the instructions on ‘Troubleshooting guide  |  Gemini API  |  Google AI for Developers’.