Agent definitions with colons in description frontmatter fail to register
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?
Environment:
- Claude Code version: 2.1.1
- OS: macOS (Darwin 25.2.0)
Description:
Agent definition files in .claude/agents/ fail to be recognized by Claude Code when the description field in the YAML frontmatter contains unquoted colons (:).
Expected Behavior:
The agent should be recognized and available for use. YAML string values containing colons should be parsed correctly, as colons within a value (not at key position) are valid YAML.
Actual Behavior:
The agent is not recognized by Claude Code. The YAML parser appears to misinterpret colons within the description value.
Workaround:
Enclosing the description value in quotes resolves the issue:
---
name: test-agent
description: "Use this agent when you need help. This includes: task A, task B, and task C."
model: sonnet
---
What Should Happen?
Agent should register as it did prior to v. 2.1.1.
Error Messages/Logs
Attempts to invoke the agent are met with "Agent type '[agent-name]' not found"
Agent does not appear in `/agents` list.
Steps to Reproduce
- Create an agent file at
.claude/agents/test-agent.mdwith the following content:
---
name: test-agent
description: Use this agent when you need help. This includes: task A, task B, and task C.
model: sonnet
---
Agent instructions here.
- Run
/agentsor attempt to invoke the agent - The agent does not appear in the list / cannot be invoked
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.76
Claude Code Version
2.1.1 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Additional Context:
- This appears to be a regression - agent definitions with colons in descriptions worked in previous versions
- Multiple existing agents that previously functioned correctly stopped being recognized after upgrading to 2.1.1
- The issue specifically affects colons (
:); other special characters may or may not be affected
Suggested Fix:
The YAML frontmatter parser should either:
- Handle unquoted string values containing colons correctly (per YAML spec, colons are only special when followed by a space at key position)
- Or provide a clear error message indicating the description needs to be quoted
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗