Gemini CLI 400 INVALID_ARGUMENT with REA
Unofficial guide. This site is an independent community guide and is not affiliated with the REA project. For authoritative docs see the official REA website and the morluto/rea GitHub repository. Commands here are taken from the official README/docs (checked 2026-10-19); REA changes quickly, so verify against the official docs.
If Gemini CLI (or another client using Gemini models) fails with 400 INVALID_ARGUMENT "Request contains an invalid argument" as soon as REA is enabled, and works again when you disable REA, the cause is REA's tool schemas, not your config. Google's API rejects the whole request because a few REA 6.5.0 tools advertise boolean const values, while Gemini only accepts string enum values. The fix is merged on main but wasn't in a published release when we checked on 2026-10-17 (npm latest = 6.5.0).
The error
Gemini CLI 0.64.0 shows only the generic message (#4620):
✕ [API Error: {"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"Request contains an invalid argument.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n","code":400,"status":"Bad Request"}}]
OpenCode with the Gemini provider shows the exact field (#4025, rea-agents 6.4.0):
Invalid value at 'tools[0].function_declarations[112].parameters.properties[3].value.any_of[0].enum[0]' (TYPE_STRING), false
Invalid value at 'tools[0].function_declarations[112].parameters.properties[3].value.any_of[1].enum[0]' (TYPE_STRING), true
We checked it on 6.5.0
We started npx -y [email protected] mcp, listed its tools over MCP and searched every input schema for non-string const/enum values. The result matches #4025 exactly: 5 tools, 38 occurrences. The compact schema profile cuts that to 5 but doesn't remove them:
# MCP stdio: initialize → tools/list, then walk every inputSchema for non-string const/enum
$ python3 scan.py # [email protected], default profile
tools 207
{'inspect_web_page': 2, 'analyze_web_bundle': 1, 'compare_web_captures': 30, 'inspect_electron_page': 4, 'evaluate_reconstruction_coverage': 1} 38
$ REA_MCP_INPUT_SCHEMA_PROFILE=compact python3 scan.py
tools 207
{'inspect_web_page': 2, 'analyze_web_bundle': 1, 'inspect_electron_page': 2} 5
We don't have a Gemini API key on the test machine, so we didn't send a request to Gemini. The scan confirms the schema problem; the 400 itself comes from the two issue reports.
Fixes, in order of effort
- Wait for the next release, then update. The fix is commit a2e30168a, "fix(mcp): relax Boolean literals without narrowing valid inputs" (2026-10-15). After a release newer than 6.5.0 ships, run
npx rea-agents@latest setup --client gemini_clito move the pinned version, then restart Gemini CLI. Check withnpm view rea-agents version. - Use a non-Gemini model for REA sessions until then. The problem is specific to Gemini's function-declaration validation.
- Run REA from source (advanced). A maintainer suggested cloning the repo, then
npm ci && npm run build, and pointing the MCP server at that build. Not tested by us. REA_MCP_INPUT_SCHEMA_PROFILE=compactalone is not enough. 5 boolean consts remain in our scan, and #4025 reports the same.
Getting the exact field path from Gemini CLI
Gemini CLI doesn't print fieldViolations, even with full error verbosity. Commenters on #4620 suggest capturing the request through an HTTPS inspection proxy (for example mitmproxy, via HTTPS_PROXY) to see the full function_declarations array. Only do this on your own machine and traffic.
Related guides
- REA with Windsurf, Gemini CLI, VS Code & more
- REA MCP config generator
- REA tools filling Claude Code context
- Troubleshooting & FAQ
Sources: issue #4620 · issue #4025 · fix commit a2e30168a
FAQ
Why does Gemini CLI return 400 INVALID_ARGUMENT with REA?
rea-agents 6.5.0 advertises boolean const values in 5 tool schemas; Gemini requires string enum values and rejects the whole request.
Does REA_MCP_INPUT_SCHEMA_PROFILE=compact fix it?
Not fully: in our scan of 6.5.0 it reduced 38 occurrences to 5, which is still enough to be rejected.
When is it fixed?
The fix (a2e30168a) is on main; update with npx rea-agents@latest setup once a release newer than 6.5.0 is published.