google-gemini / google-gemini/gemini-cli

Duplicate agent name warning when running Gemini CLI from the user's home directory

Open
#27,692 5 comments 0 reactions 0 assignees View on GitHub
area/core effort/small kind/bug priority/p2 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

**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 '' 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.