Skip to content

Gemini rejects tool declarations with empty-string enum values (answer_commit) #1531

Closed

Description

@anandgupta42

Every request to a Gemini model (google/* or google-vertex/*) that includes the analyst agent's answer_commit tool fails before the model runs:

APIError (status 400): * GenerateContentRequest.tools[0].function_declarations[44].parameters.properties[unresolved].any_of[1].enum[0]: cannot be empty

answer_commit wraps its optional fields in a union that accepts "" (strict-schema providers fill unused properties with empty strings). That z.literal("") is emitted as const: "" / enum: [""], and the Gemini API rejects empty-string enum values. The Gemini branch of ProviderTransform.schema stringifies enum values but does not drop empty ones.

Expected: the Gemini schema sanitizer removes empty-string enum/const values, so any tool whose schema contains them can be declared to Gemini. Runtime Zod validation of tool arguments is unchanged.

Activity

  1. added a commit that references this issue on Oct 17, 2026
    05cc4d1
  2. sahrizvi commented on Oct 23, 2026

    @sahrizvi
    Collaborator

    Resolved in v0.12.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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