Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error details

Aperta
#1,282 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hemasekhar-p ci sta già lavorando.

Dal 5/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

priority: p2 type: bug
Environment
  • com.google.genai:google-genai:1.73.0
  • Java 21+
Problem Description

When a call to client.interactions.create(...) fails with an HTTP 4xx error (throwing CreateInteractionClientError, a subclass of GaosClientException), Throwable.getMessage() returns only:

400 . API error occurred

The actual diagnostic JSON error body returned by the server (e.g. {"error":{"message":"...","code":"invalid_request"}}) is only accessible if the caller explicitly catches GaosClientException and calls e.bodyAsString().

By comparison, com.google.genai.errors.ApiException (thrown by client.models.*) includes the server's error message directly in getMessage(), making stack traces and logs immediately actionable.

Steps to Reproduce
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GenerationConfig;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ThinkingLevel;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

public class ErrorRepro {
  public static void main(String[] args) {
    Client client = Client.builder().build();

    var request =
        CreateModelInteraction.builder()
            .model(Model.GEMINI_3_FLASH_PREVIEW)
            .input(InteractionsInput.of("Hello"))
            .generationConfig(
                GenerationConfig.builder()
                    .thinkingLevel(ThinkingLevel.MINIMAL) // unsupported on gemini-3-flash-preview
                    .build())
            .build();

    // Throws CreateInteractionClientError with message: "400 . API error occurred"
    // instead of including: "Thinking level THINKING_LEVEL_MINIMAL is not supported for this model."
    client.interactions.create(CreateInteractionRequestBody.of(request));
  }
}
Expected Behavior

GaosClientException (and its subclasses like CreateInteractionClientError) should include the server error message or bodyAsString() in getMessage().

Lingua principale
Java
Stelle
398
Fork
126
Merge medio
1g 12h
PR unite (30g)
71

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di googleapis/java-genai

Tutte le issue di googleapis/java-genai

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.