Skip to content

StreamConstraintsException when generating audio - Jackson 20MB string limit #497

@offnertho

Description

@offnertho

Description:

This is a client library issue related to Jackson's StreamReadConstraints limiting audio response processing.

Environment details

  • Programming language: Java/Kotlin
  • OS: macOS/Linux/Windows (affects all platforms)
  • Language runtime version: Java 17+
  • Package version: com.google.genai:google-genai:1.10.0

Steps to reproduce

  1. Use the SDK to call generateContentStream() with audio response modality
  2. Provide text input that generates audio responses larger than ~20MB
  3. Observe StreamConstraintsException thrown by Jackson

Expected Behavior:
The SDK should handle audio responses of any reasonable size, as audio generation commonly produces responses larger than 20MB.

Actual Behavior:
The SDK fails with:
com.fasterxml.jackson.core.exc.StreamConstraintsException: String value length (20048112) exceeds the maximum allowed (20000000, from
StreamReadConstraints.getMaxStringLength())
at com.google.genai.JsonSerializable.stringToJsonNode(JsonSerializable.java:146)

Additional Context:
Audio generation is a standard use case for the Gemini API, and the 20MB limit makes the SDK unusable for this purpose. The limit should be removed or significantly increased
for audio responses.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions