Claude Code /doctor: "Failed to parse 1 agent file(s): unknown: location is not defined"
Claude Code on macOS stopped loading custom agents and
/doctorshows "Failed to parse 1 agent file(s): unknown: location is not defined" after updating wshobson/agents. Reverting to Claude Code 1.0.77 lists files in~/.claude/agents/(README.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md) as "Missing required name field in frontmatter". What causes this and how do I fix it?Originally asked on GitHub: https://github.com/wshobson/agents/issues/52
6 answers
Fixed in Claude Code 1.0.81, per the changelog (opens external site) linked in the thread; the issue was closed as completed.
On the builds affected,
/doctorfailed hard when anything in~/.claude/agents/was not a valid agent. The errorFailed to parse 1 agent file(s): unknown: location is not defineddid not even name the offending file, and no custom agents loaded. Claude Code 1.0.77 behaved differently: it listed each bad file (Missing required "name" field in frontmatter) and still loaded the valid agents.What caused it, according to the reporters:
- Non-agent markdown files (
README.md,CONTRIBUTING.md,CODE_OF_CONDUCT.md) inside the agents directory. .gitfolders inside agent subfolders.- A single corrupted agent file was enough to block all agents.
Workarounds that worked while the bug was live:
- Clean up the agents directory: remove all
.gitfolders andreadme.mdfiles, and delete any corrupted agent files. - Generate a fresh agent from Claude Code inside
~/.claude/agents/. - Remove readme files from the agents directory.
- Revert to Claude Code 1.0.77, which loads healthy agents and names the files that fail to parse.
As a general guideline, keep only real agent markdown files with a valid
namefield in frontmatter in~/.claude/agents/.Did this work for you?- Non-agent markdown files (
What @lithyem tried on GitHub (Worked)
Removed all files from the agents directory and created a fresh agent, then removed every
.gitfolder andreadme.mdfile from agent subfolders. One corrupted agent file still blocked loading and was deleted, after which everything worked.Source: https://github.com/wshobson/agents/issues/52#issuecomment-3189036241 (opens external site)
Did this work for you?What @rdbeltrao tried on GitHub (Worked)
Generated a new agent directly from Claude Code into
~/.claude/agents/; this fixed the parse error for that user.Source: https://github.com/wshobson/agents/issues/52#issuecomment-3187755770 (opens external site)
Did this work for you?What @jeshuaborges tried on GitHub (Worked)
Found a readme file inside the agents directory and identified it as the reason agents failed to load.
Source: https://github.com/wshobson/agents/issues/52#issuecomment-3188225235 (opens external site)
Did this work for you?What @msullivanhdt tried on GitHub (Worked)
Tried all the suggested workarounds without success; the only fix that worked was reverting to Claude Code 1.0.77.
Source: https://github.com/wshobson/agents/issues/52#issuecomment-3188870463 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Worked)
Reverted to Claude Code 1.0.77;
/doctorthen showed the three problematic files (README.md,CONTRIBUTING.md,CODE_OF_CONDUCT.mdin~/.claude/agents/) as missing a requirednamefield in frontmatter, and all other agents loaded.Source: https://github.com/wshobson/agents/issues/52 (opens external site)
Did this work for you?
Related questions
- What model names does Claude Code expect in subagent frontmatter: opus, sonnet, haiku?
- Claude Code plugin agents 404 "model: sonnet" — how to fix?
- Fix 'Large cumulative agent descriptions will impact performance' after installing wshobson/agents plugins in Claude Code
- Claude Code /plugin marketplace add fails to clone wshobson/agents
- How reliable are wshobson/agents security-auditor and code-reviewer across Claude models?