gemini-cli - 💡(How to fix) Fix [Bug] Audio/wav file handling causes API errors and context overestimation [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The current implementation of Gemini CLI has several critical issues when handling audio files:

  1. Incorrect Nesting: Audio files are nested in function_response.parts, which is not supported by the Gemini API (results in 400 Bad Request).
  2. Token Overestimation: Audio files default to string length for token counting, leading to context usage reports exceeding 600%.
  3. Compression Failure: Raw audio bytes are sent to the summarizer model, causing OOM or API errors.
  4. Configuration Ignored: The compressionThreshold setting is ignored during ContextManager initialization.

Root Cause

The current implementation of Gemini CLI has several critical issues when handling audio files:

  1. Incorrect Nesting: Audio files are nested in function_response.parts, which is not supported by the Gemini API (results in 400 Bad Request).
  2. Token Overestimation: Audio files default to string length for token counting, leading to context usage reports exceeding 600%.
  3. Compression Failure: Raw audio bytes are sent to the summarizer model, causing OOM or API errors.
  4. Configuration Ignored: The compressionThreshold setting is ignored during ContextManager initialization.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Description

The current implementation of Gemini CLI has several critical issues when handling audio files:

  1. Incorrect Nesting: Audio files are nested in function_response.parts, which is not supported by the Gemini API (results in 400 Bad Request).
  2. Token Overestimation: Audio files default to string length for token counting, leading to context usage reports exceeding 600%.
  3. Compression Failure: Raw audio bytes are sent to the summarizer model, causing OOM or API errors.
  4. Configuration Ignored: The compressionThreshold setting is ignored during ContextManager initialization.

Expected Behavior

  • Audio should be sent as sibling parts (supported for Gemini 3).
  • Realistic token heuristics should be used for audio.
  • Binary data should be stripped before summarization.
  • User settings should be respected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix [Bug] Audio/wav file handling causes API errors and context overestimation [1 pull requests]