Skip to content

Fix Gemini driver crash on content entries without parts#788

Open
pbranchu wants to merge 1 commit intoRightNow-AI:mainfrom
pbranchu:fix/gemini-empty-parts
Open

Fix Gemini driver crash on content entries without parts#788
pbranchu wants to merge 1 commit intoRightNow-AI:mainfrom
pbranchu:fix/gemini-empty-parts

Conversation

@pbranchu
Copy link

Summary

Add #[serde(default)] to GeminiContent.parts to prevent deserialization crash.

Problem

When Gemini returns a content entry with only a role and no parts array (observed with large tool counts, 100+), the response parser fails with missing field 'parts', crashing the agent loop.

Fix

One-line change: #[serde(default)] on the parts field defaults to an empty Vec instead of failing.

Test plan

  • cargo check passes
  • Existing Gemini driver tests pass

🤖 Generated with Claude Code

Add #[serde(default)] to GeminiContent.parts so responses with
empty or missing parts arrays deserialize as empty Vec instead
of failing with "missing field parts".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant