[BUG] Please reopen #6377 ("Frontmatter Parsing Error: Missing 'name' Field Despite Valid YAML")
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
This is NOT a new bug, but it definitely has not been resolved, and all dupes have been closed/dupe, or closed/inactive, except for #6377, which github-actions "Closed as not planned"(?!) last week.
My info:
Operating System: Fedora 43 6.18.3-200.fc43.x86_64
Terminal: ghostty 1.2.3-2.fc43
However:
According to (closed) issues (and, based on my dumpster-diving here, in unrelated issue's error logs), this has happened on all platforms, and many versions: current and even pre-2.0.
Definitely an issue, with latest (2.1.2, as of this post).
This has been appearing consistently in unrelated error logs in tens of GH issues since Aug/Sept '25.
AFAICT, this breaks agents completely, as none are even discovered.
Great Catch-22 btw: can't omit name; any attempt to include name causes error.
What Should Happen?
Claude should discover, load, and use agents defined in .md files with valid front-matter
Error Messages/Logs
/doctor
Agent Parse Errors
└ Failed to parse 8 agent file(s):
└ ~/.claude/agents/code-reviewer.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/js-debugger.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/le-dépôt-ménager.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/py-debugger.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/swe-master-prompter.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/unstucker.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/test-automator.md: Missing required "name" field in frontmatter
└ ~/.claude/agents/python-pro-coder.md: Missing required "name" field in frontmatter
Steps to Reproduce
- Create agent.md file, with e.g.
---
name: code-reviewer
---
<valid Markdown agent definition>
- Load/Re-load claude-code
- Run
/doctor
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Sorry, not certain. Probaby pre-August '25.
Claude Code Version
2.1.2 (Claude Code)
Platform
Google Vertex AI
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
All of
- #6709
- #6868
- #6950
- #7280
- #7281
- #7303
- #7448
- #7794
- #7850
- #7903
contain this exact error, during the time span in question (Aug-Sep '5 -- present), in spite of none actually being filed for this exact issue.
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Asked Claude Code about it (unedited except for line wraps for readability):
Explain to me why the
/doctorcommand is incorrectly marking ALL agentdefinitions in @agents/ as "Missing required "name" field in frontmatter".
⎿ Listed directory agents/
● Let me read the agent definition files to understand their structure.
● Read(agents/code-reviewer.md)
⎿ Read 245 lines
● Read(agents/python-pro-coder.md)
⎿ Read 247 lines
● The agent definition files have valid YAML frontmatter with name fields. The
/doctor command is incorrectly flagging them. Let me search for the /doctor
command implementation to understand why.
● Explore(Find /doctor command code)
⎿ Done (25 tool uses · 64.6k tokens · 2m 27s)
● The /doctor command incorrectly flags your agent files due to a known bug in
Claude Code (Issue #6377 and many duplicates).
Summary
Your agent files are correctly formatted—they have valid YAML frontmatter with
name fields. The problem is in Claude Code's validation logic.
Root Cause
The /doctor command has a frontmatter parsing bug that affects many users
(especially on Linux in VSCode terminal). The validation fails to parse valid
YAML frontmatter and reports "Missing required 'name' field" even when the
field exists.
GitHub tracked this at Issue #6377, which was closed as "NOT_PLANNED" with 10+
duplicate reports (#6709, #6868, #6869, #6950, #7280, #7281, #7303, #7448,
#7794, #7850).
Verification
Your files are correct:
Both have:
Workarounds
cat -A agents/code-reviewer.md | head -5
file -bi agents/code-reviewer.md
Assumption
The bug is in Claude Code's compiled CLI, not your files. The validation code
(obfuscated in cli.js) has parsing issues that haven't been fixed.
Tests as suggested by C-C:
I note with interest that CC says "Ignore the warning: The agents work despite the validation error"
Sus, but I'll try it and see if they work.
Works 🎉
This indicates to me that #11205 is not a dupe.
I have no
:indescriptionfrontmatter, so my guess would be that #16916 is not a dupe.As mentioned at the outset, this IS a dupe of #6377, but #6377 never should have been closed.
I noticed this as well in the 2.1.3 release, because the agents DO NOT DISPLAY when I type
/agents, and I receive this error for 7 of my 19 custom agents when I run/doctor.The issue DOES NOT OCCUR in 2.0.76, and all of my agents appear as expected. This is a regression in the 2.1 branch.
Any solution to this?
The only way I was able to workaround it was by deleting and re-creating the problematic sub-agents. I still don't know what in the agent config was causing the issue, but that workaround resolved it.
It is looks like that bug is related to UTF-8 BOM. In default mode VS Code use that format for md files.
Root Cause: Session-Level Caching
I tracked this down and found the actual root cause: Claude Code caches agent file parse results at session startup. The
/doctorcommand reads from this in-memory cache, not from disk.This means:
/doctorkeeps reporting the error from cacheThis also explains why the "delete and recreate" workaround reported by @shssoichiro works — it likely involved restarting Claude Code between the delete and recreate steps, which reset the cache.
Steps to fix:
namefield)/exitor Ctrl+C)/doctor— agents should now parse correctlyThe confusing part is that
/doctoris supposed to be a diagnostic tool, but by reading from cache instead of re-parsing from disk, it gives stale results that make you think your fix didn't work.I don't believe your AI-generated diagnosis is accurate. The
namefield _is_ valid in all of the configurations, as far as users can see. This also would not explain why the issue was not present in 2.0.76, despite no changes being made to the agent configs.I thought the UTF-8 BOM idea was reasonable, but I went back and checked my files before and after (since I keep them in git), and all of them were saved as UTF-8 without BOM both before and after.
I did some more experimenting, however, and it seems to be related to certain characters in the
descriptionfield which break parsing in Claude Code 2.1.x but not in 2.0.76. Anydescriptionwhich contains certain characters (I haven't narrowed down a full list, but some seem to include"and\n) must be fully enclosed in quotation marks and have the problematic characters escaped with a preceding\. I'll also note that these agents were all generated using Claude Code, so it is problematic that a future Claude Code update broke parsing of agents generated by an earlier version.Well, I got it fixed! Just sharing what did the trick for me.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.