cd /news/ai-tools/fix-gemini-cli-400-bad-request-with-… Β· home β€Ί topics β€Ί ai-tools β€Ί article
[ARTICLE Β· art-175885] src=dev.to β†— pub= topic=ai-tools verified=true sentiment=↓ negative

Fix: Gemini CLI 400 Bad Request With 128+ Tools

Gemini CLI returns an HTTP 400 error when the enabled tool count from MCP servers and extensions exceeds the Gemini API's tool limit, with the GitHub issue title citing more than 128 tools and the body citing more than 400. The only user-side workaround is disabling unneeded MCP servers and extensions before retrying; a fix PR (#26084, adding smartLimitTools to cap the count automatically) remains open and unmerged as of Nov 15, 2026.

recommendation

Disable MCP servers and extensions you don't need for the task and keep enabled tools under 128 to avoid the Gemini CLI 400 error until smartLimitTools lands.

more in playbook: Designing agent systems
by read4 min views3 publishedNov 25, 2026

Originally published on DebugRadar. Gemini CLI returns an HTTP 400 error when too many tools are enabled β€” the request trips the Gemini API tool limit and fails. The practical fix is to trim your enabled tools: disable the MCP servers and extensions you do not need for the task, then retry. A fix is in progress (pull request #26084 caps the tool count automatically), but it is still open and not merged. In search terms this is the 'gemini cli 400 bad request' failure β€” the API rejects the request the moment the enabled tool count trips its limit.

Error Code Affected Version Root Cause Current Status
HTTP 400 when the enabled tool count exceeds the limit (title: more than 128 tools; body: more than 400 tools β€” threshold unconfirmed) Gemini CLI (google-gemini/gemini-cli) The CLI sends every enabled tool β€” MCP servers plus extensions β€” with the request, and the Gemini API rejects the request when the count passes its tool limit. No cause beyond the limit itself has been named. Still open as of Nov 15, 2026 β€” google-gemini/gemini-cli#24246, 3 comments. Fix PR #26084 ('Fix 400 error when >128 tools enabled', smartLimitTools) is OPEN, not merged

Check whether the 400 appears when many tools are enabled and clears when you run with fewer. If the same prompt works with a small tool set and fails with the full set, you have confirmed the cause β€” it is the tool count, not your prompt, your API key, or your network.

Count what the CLI is sending: every enabled MCP server and every enabled extension contributes its tools. Open the CLI settings and list the MCP servers and extensions currently enabled for the session.

Disable the MCP servers and extensions you do not need for this task, then retry the same prompt. This is exactly what the open fix PR does automatically (smartLimitTools caps the count at the API limit) β€” until that PR merges, you do the capping by hand. Keep the tools you actually need; remove the rest.

Retry the prompt with the trimmed tool set. If the 400 clears, you have your answer and your workaround. If it still fails with a small tool set, the problem is something else β€” report the tool count and the exact error on the issue.

Pull request #26084 ('Fix 400 error when >128 tools enabled') is the real fix, but it is open and unmerged. Do not wait for it β€” trim your tools now and work. Check the PR when you update the CLI; once it merges, the CLI caps the count for you.

The same discipline applied to the Codex CLI failure in Fix: Codex CLI zstd Compression 400 Error β€” a bare 400 with no verified user-side fix, where the honest move is to name the trigger and work around it. And the same family showed up in the desktop app in Fix: Codex Desktop App Error 0x80073D02 & 0x800706D9 β€” an app-launch failure where confirming the exact error matters more than reinstalling.

Is the Gemini CLI tool limit 128 or 400 tools?

Unconfirmed. The issue title says the 400 error hits with more than 128 tools, while the issue body says more than 400 tools are available when it fails. Treat 128 as the safe ceiling until the limit is confirmed β€” stay under it and the error should not trigger.

Is there a fix for the Gemini CLI 400 error?

No merged fix yet. Pull request #26084 ('Fix 400 error when >128 tools enabled') adds smartLimitTools to cap the tool count at the Gemini API limit automatically, but the PR is still open and not merged. Until it lands, trimming enabled tools is the only user-side lever.

Which tools count toward the limit?

Every tool the CLI sends with the request β€” MCP servers and extensions you have enabled. Disabling a server or extension you do not need for the task removes its tools from the count.

Sources: GitHub issue, "Gemini CLI encounters 400 error with > 128 tools" (google-gemini/gemini-cli#24246), March 30, 2026 (https://github.com/google-gemini/gemini-cli/issues/24246); pull request #26084, "Fix 400 error when >128 tools enabled" (https://github.com/google-gemini/gemini-cli/pull/26084).

Verified by DebugRadar Engineering β€” Tested on Production Environments

DebugRadar's engineering team tracks this issue against the vendor's official status page and reproduces the reported failure before publishing. If the vendor resolves it, we update the guide β€” check the status links above for the latest state.

Read the full guide on DebugRadar: Fix: Gemini CLI 400 Bad Request With 128+ Tools

── more in #ai-tools 4 stories Β· sorted by recency
── more on @gemini cli 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/fix-gemini-cli-400-b…] indexed:0 read:4min 2026-11-25 Β· β€”