Skip to content

Gemini API 400: functionResponse.name cannot be empty when proxying via antigravity #2104

@jveko

Description

@jveko

Description

When using clients like Amp that proxy requests through CLIProxyAPI to Google's Gemini API via the antigravity translator, requests fail with a 400 error:

* GenerateContentRequest.contents[2].parts[0].function_response.name: Name cannot be empty.
* GenerateContentRequest.contents[2].parts[1].function_response.name: Name cannot be empty.
...

Steps to Reproduce

  1. Use Amp (or any client) connected to CLIProxyAPI's antigravity endpoint
  2. Trigger a multi-tool-call interaction (e.g. the finder/search agent)
  3. The model returns multiple functionCall parts, client executes them and sends back functionResponse parts
  4. The proxy forwards functionResponse parts with empty name fields to Gemini API
  5. Gemini rejects the request with 400 INVALID_ARGUMENT

Root Cause

Incoming requests from clients include functionResponse parts without populating the name field. The proxy's fixCLIToolResponse in the antigravity translator forwards them as-is without resolving the name from the corresponding functionCall parts in the preceding model content.

Additionally, ConvertOpenAIResponsesRequestToGemini scans the raw input array for matching function_call items by call_id, but may fail to find matches since the function calls may not be present as top-level items in the input.

Expected Behavior

The proxy should backfill empty functionResponse.name from the corresponding functionCall.name before forwarding to Gemini.

Environment

  • CLIProxyAPI antigravity translator
  • Google Gemini API (daily-cloudcode-pa.googleapis.com)
  • Client: Amp (finder/search subagent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions