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

  1. Create any agent via /agents in a project (succeeds — directory is created)
  2. Open /agents again and create a second agent in the same project
  3. 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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗