Claude Code crashes on YAML parse error in command frontmatter
Resolved 💬 5 comments Opened Jan 9, 2026 by mikelane Closed Feb 23, 2026
Summary
Claude Code crashes with an unhandled exception when a custom command file (.claude/commands/*.md) contains invalid YAML in its frontmatter. The crash occurs during startup when scanning for commands.
Steps to Reproduce
- Create a command file:
.claude/commands/test/crash.md - Add frontmatter with brackets containing a colon:
``yaml``
---
description: Test command
argument-hint: [optional: some value]
---
- Start Claude Code in that directory
- Claude Code crashes immediately
Expected Behavior
Claude Code should:
- Gracefully handle YAML parse errors
- Display a warning like: "Warning: Failed to parse command file .claude/commands/test/crash.md - invalid YAML"
- Skip the invalid command and continue loading
Actual Behavior
Unhandled exception crashes the CLI:
file:///Users/mikelane/.nvm/versions/node/v24.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:743:8724
- cB (file:///...cli.js:743:8724)
- XB (file:///...cli.js:743:10834)
- QD (file:///...cli.js:743:12402)
...
Root Cause
The argument-hint field uses a convention of [placeholder text] to indicate optional/variable content. However, YAML interprets [...] as flow sequence (array) syntax. When the content inside isn't valid array syntax (e.g., contains colons), YAML parsing fails.
Suggested Fix
- Wrap YAML parsing in try-catch and log warnings for invalid files
- Consider documenting that brackets should be quoted or avoided in frontmatter
- Optionally: auto-quote string values that look like arrays but aren't
Environment
- Claude Code version: latest (via npm @anthropic-ai/claude-code)
- Node.js: v24.12.0
- OS: macOS Darwin 25.3.0
Workaround
Remove brackets from argument-hint values or quote them:
argument-hint: "optional: some value"This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗