Fix: Gemini CLI 400 Bad Request With 128+ Tools

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.

Quick Fix Summary

  • Problem: Gemini CLI returns an HTTP 400 error when too many tools are enabled — the request exceeds the Gemini API tool limit and the API rejects it.
  • Fix: Trim your enabled tools: disable the MCP servers and extensions you do not need for the task, then retry. The open fix PR (#26084) will cap the count automatically once merged — until then, the tool count is the only user-side lever.
  • What happened: Reported in google-gemini/gemini-cli#24246 (3 comments), created March 30, 2026, updated November 15, 2026. Still open. Honest caveat: the issue is old, and the title says the error hits with more than 128 tools while the body says more than 400 tools are available — the exact threshold is unconfirmed, so treat 128 as the safe ceiling.

Technical Root Cause

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

Step-by-Step: What to Do When Gemini CLI Returns a 400 Bad Request

Step 1 — Confirm the 400 Is the Tool-Limit Error

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.

Step 2 — List Your Enabled Tools

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.

Step 3 — Disable the Tools You Do Not Need

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.

Step 4 — Retry With the Trimmed Set

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.

Step 5 — Watch PR #26084, Do Not Wait For It

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.

FAQ

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.

Leave a Comment