gemini-cli - 💡(How to fix) Fix Gemini‑CLI: Excessive project‑wide scanning makes simple code patches fail [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25672Fetched 2026-04-20 12:15:36
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
labeled ×1

Fix Action

Fix / Workaround

When using Gemini‑CLI to apply small patches to Go source files, the tool repeatedly performs full‑project analysis before making any edit. This includes:

Impact: Even tiny one‑function patches often fail

Multi‑file patches are nearly impossible

RAW_BUFFERClick to expand / collapse

What happened?

When using Gemini‑CLI to apply small patches to Go source files, the tool repeatedly performs full‑project analysis before making any edit. This includes:

scanning all files in the workspace

loading the entire Go standard library

loading cgo files

running vulnerability checks

running diagnostics

resolving cross‑file references

This behavior consumes tokens extremely quickly and causes the model to hit usage limits before the actual edit is applied.

Impact: Even tiny one‑function patches often fail

Multi‑file patches are nearly impossible

Users must break missions into micro‑missions

Diagnostics and vulnerability checks are unnecessary for simple edits

The tool becomes unusable on medium‑sized Go projects

Expected behavior: When the mission is “modify this file at this function,” Gemini‑CLI should:

Open the file

Apply the patch

Save the file

It should not automatically run diagnostics, vulnerability checks, or full‑project scans unless explicitly requested.

Suggested improvements: Add a “minimal edit mode” that disables diagnostics and project‑wide scanning

Only load the target file unless the user requests deeper analysis

Avoid scanning cgo files unless necessary

Provide a flag to disable vulnerability checks

Cache project structure to avoid repeated scanning

What did you expect to happen?

Simply edits/modifications/patches done by gemini-cli should be possible without consuming excessive tokens or even failing completely.

Client information

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ About Gemini CLI │ │ │ │ CLI Version 0.38.2 │ │ Git Commit b0ed611a0 │ │ Model gemini-3-flash-preview │ │ Sandbox no sandbox │ │ OS win32 │ │ Auth Method gemini-api-key │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

                                                                                                                        ? for shortcuts

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Shift+Tab to accept edits 2 GEMINI.md files · 2 MCP servers ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

Type your message or @path/to/file

/mcp ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ Configured MCP servers:

🟢 gopls - Ready (8 tools) Tools:

  • mcp_gopls_go_diagnostics
  • mcp_gopls_go_file_context
  • mcp_gopls_go_package_api
  • mcp_gopls_go_rename_symbol
  • mcp_gopls_go_search
  • mcp_gopls_go_symbol_references
  • mcp_gopls_go_vulncheck
  • mcp_gopls_go_workspace

🟢 delphilsp - Ready (5 tools) Tools:

  • mcp_delphilsp_delphi_completion
  • mcp_delphilsp_delphi_find_references
  • mcp_delphilsp_delphi_goto_definition
  • mcp_delphilsp_delphi_hover
  • mcp_delphilsp_delphi_workspace_symbols

Login information

No response

Anything else we need to know?

Note:

mcp_gopls is installed and apperently gemini-cli is overly enthousiastic/overly helpfully at running it...

extent analysis

TL;DR

Implement a "minimal edit mode" in Gemini-CLI to disable unnecessary diagnostics and project-wide scanning for small patches.

Guidance

  • Identify the specific tools and features in mcp_gopls that are causing excessive token consumption, such as mcp_gopls_go_diagnostics and mcp_gopls_go_vulncheck.
  • Consider disabling or configuring these tools to run only when necessary, rather than on every edit.
  • Investigate caching project structure to avoid repeated scanning and reduce token consumption.
  • Explore adding a flag to disable vulnerability checks for simple edits.

Example

No code snippet is provided as the issue is more related to tool configuration and behavior.

Notes

The issue seems to be related to the overly enthusiastic behavior of Gemini-CLI when running mcp_gopls tools. The solution may involve configuring or disabling certain tools, but the exact steps will depend on the specific requirements and constraints of the project.

Recommendation

Apply a workaround by configuring mcp_gopls tools to run only when necessary, as the issue is likely due to the excessive running of diagnostics and vulnerability checks. This should help reduce token consumption and make the tool more usable for small patches.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING