-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Description
When a Claude API request contains an assistant message with empty text content, the Antigravity/Gemini translator produces an invalid request that causes the Gemini API to return a 400 error.
Error Message
{
"error": {
"code": 400,
"message": "* GenerateContentRequest.contents[1].parts[0].data: required oneof field 'data' must have one initialized field",
"status": "INVALID_ARGUMENT"
}
}Reproduction
Send a Claude API request with an assistant message containing empty text:
{
"messages": [
{"role": "user", "content": [{"type": "text", "text": "你好"}]},
{"role": "assistant", "content": [{"type": "text", "text": ""}]},
{"role": "user", "content": [{"type": "text", "text": "..."}]}
]
}Root Cause
In internal/translator/antigravity/claude/antigravity_claude_request.go, when processing text content, if the text is empty, a part object {} is still created and added to the parts array. The Gemini API requires every part to have at least one data field initialized.
Expected Behavior
Empty text parts should be skipped during translation to avoid sending invalid requests to the Gemini API.
Environment
- Route:
/api/provider/anthropic/v1/messages - Backend: Antigravity (Gemini)
- Version: v6.7.26-0-plus
Metadata
Metadata
Assignees
Labels
No labels