-
-
Notifications
You must be signed in to change notification settings - Fork 69k
sanitizeToolsForGoogle() does not sanitize tools for google-generative-ai provider #20197
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Bug Description
sanitizeToolsForGoogle() only sanitizes JSON Schema keywords (like patternProperties, additionalProperties, $ref) for a subset of Google providers, missing google-generative-ai.
Current Behavior
Version 2026.2.17:
if (params.provider !== "google-gemini-cli") return params.tools;Version 2026.2.15:
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") return params.tools;Neither version sanitizes tools when params.provider === "google-generative-ai", causing raw patternProperties to be sent to the Google API.
Error
Cloud Code Assist API error (400): Invalid JSON payload received.
Unknown name "patternProperties" at 'request.tools[0].function_declarations[3].parameters.properties[2].value': Cannot find field.
Expected Behavior
All Google providers should be sanitized. A simple fix:
if (!params.provider?.startsWith("google")) return params.tools;This covers google-generative-ai, google-gemini-cli, and google-antigravity in one check.
Environment
- OpenClaw 2026.2.17 (also affects 2026.2.15)
- Provider:
google-generative-ai(API keys from Google AI Studio) - The function exists in multiple bundled JS files (
reply-*.js,pi-embedded-*.js,plugin-sdk/reply-*.js)
Workaround
Patch all JS files in the container with sed:
sed -i 's/params.provider !== "google-gemini-cli"/!params.provider?.startsWith("google")/g' /path/to/openclaw/dist/*.jsNote: patch does not survive container recreation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.