EEXIST error blocks agent creation when .claude/agents directory already exists
Open 💬 2 comments Opened Jun 15, 2026 by Rohith5547
Bug
When creating a new agent via /agents in a project where .claude/agents already exists (i.e. at least one agent was previously created), the save fails with:
EEXIST: file already exists, mkdir '<project>/.claude/agents'
The agent file is NOT written — the error is fatal, not just cosmetic.
Steps to reproduce
- Create any agent via
/agentsin a project (succeeds — directory is created) - Open
/agentsagain and create a second agent in the same project - Observe EEXIST error; the new agent file is not saved
Expected behavior
mkdir should be called with { recursive: true } (Node) or equivalent so it succeeds silently when the directory already exists.
Environment
- OS: Windows 11
- Shell: PowerShell
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗