Skip to content

BadRequestException - important details missing #609

@stargazer33

Description

@stargazer33

Enabled logging (by the way: issue 73) and saw this in stdout:

<6> okhttp3.OkHttpClient           <-- 400 https://generativelanguage.googleapis.com/v1beta/openai/chat/completions (40ms)
...       
<6> okhttp3.OkHttpClient           [{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"seed\": Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"seed\": Cannot find field."
          }
        ]
      }
    ]
  }
}
]
<6> okhttp3.OkHttpClient           <-- END HTTP (431-byte, 243-gzipped-byte body)

well, errors happen, and the details are clear enough.
But in my code - in the com.openai.errors.BadRequestException I see ONLY THIS:

Image

EXPECTED RESULT: BadRequestException should contain "Invalid JSON payload received. Unknown name "seed": Cannot find field.",
probably together with "type.googleapis.com/google.rpc.BadRequest"

This is NOT a minor issue - I should immediately see why the error happens, the "400" does not really help!

Details

    <dependency>
      <groupId>com.openai</groupId>
      <artifactId>openai-java</artifactId>
      <version>3.4.1</version>
    </dependency>

And I am calling this server: https://generativelanguage.googleapis.com/v1beta/openai
Model: gemma-3-12b-it
Here the "OpenAI compatibility" documentation: https://ai.google.dev/gemini-api/docs/openai

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions