gemini-cli - 💡(How to fix) Fix Duplicate agent name warning when running Gemini CLI from the user's home directory [2 pull requests]

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…

Root Cause

Root Cause: The CLI seems to load agent configurations from both the global path (~/.gemini/agents) and the local workspace path (./.gemini/agents). When the workspace is the home directory, these two paths point to the exact same physical directory. The CLI reads the same .md agent definition file twice without deduplicating the absolute file paths, causing a naming collision with itself.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Description: Issue: When running the Gemini CLI with the workspace directory set to the user's home directory (e.g., C:\Users\username), the CLI outputs a false-positive warning: Duplicate agent name '<agent_name>' detected. The later definition will be ignored.

Root Cause: The CLI seems to load agent configurations from both the global path (~/.gemini/agents) and the local workspace path (./.gemini/agents). When the workspace is the home directory, these two paths point to the exact same physical directory. The CLI reads the same .md agent definition file twice without deduplicating the absolute file paths, causing a naming collision with itself.

Expected Behavior: The CLI should resolve configuration paths to their absolute paths and deduplicate them before loading the configuration files. If the global config directory and the local workspace config directory are the same, it should only load the agents once and not throw a warning.

Reproduction Steps:

  1. Create a custom agent definition file in ~/.gemini/agents/test-agent.md.
  2. Open a terminal and cd to the user's home directory (~).
  3. Start the Gemini CLI.
  4. Observe the duplicate agent warning in the startup output.

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