YAML frontmatter parser too strict - crashes on valid skill descriptions #5523

Closed
opened 2026-02-16 17:53:42 -05:00 by yindo · 0 comments
Owner

Originally created by @houzixiashanxiedaima on GitHub (Jan 13, 2026).

Originally assigned to: @rekram1-node on GitHub.

Problem

OpenCode crashes with SyntaxError: Unexpected end of JSON input when parsing SKILL.md files that contain special characters in the description field without quotes. These same files work fine in Claude Code.

Error Message

ConfigFrontmatterError: ConfigFrontmatterError
data: {
  path: "/path/to/.claude/skills/commit-push-pr/SKILL.md",
  message: "Failed to parse YAML frontmatter: incomplete explicit mapping pair; 
            a key node is missed; or followed by a non-tabulated empty line at line 3, column 37"
}

This causes the SDK to receive an empty/malformed response, leading to:

Error: Unexpected end of JSON input
    at <anonymous> (../sdk/js/src/v2/gen/client/client.gen.ts:167:33)

Reproduction

Create a SKILL.md with this frontmatter:

---
name: my-skill
description: Quick workflow: commit + push. Triggers: "快速提交", "submit directly".
---

Problematic characters:

  • : (colon + space) - YAML interprets as key-value separator
  • "..." (embedded quotes) - conflicts with YAML string syntax
  • (unicode arrows) - some parsers choke on these

Expected Behavior

OpenCode should either:

  1. Use a more lenient YAML parser (like Claude Code does)
  2. Provide a clear, actionable error message instead of crashing
  3. Gracefully skip malformed skills with a warning

Comparison with Claude Code

Tool Parser Behavior
Claude Code Simple regex/text matching Parses successfully (lenient)
OpenCode js-yaml (strict) Crashes with JSON error

Workaround

Wrap description in single quotes:

description: 'Quick workflow: commit + push. Triggers: "快速提交".'

But this shouldn't be required if the content is valid for lenient parsers.

Environment

  • OpenCode version: 1.1.18
  • OS: macOS
  • Plugin: opencode-antigravity-auth

Suggested Fix

  1. Add try-catch around YAML parsing with descriptive error messages
  2. Consider using a more lenient parser or fallback parsing strategy
  3. Don't let frontmatter parsing failures cascade into JSON parsing errors

🤖 Generated with Claude Code

Originally created by @houzixiashanxiedaima on GitHub (Jan 13, 2026). Originally assigned to: @rekram1-node on GitHub. ## Problem OpenCode crashes with `SyntaxError: Unexpected end of JSON input` when parsing SKILL.md files that contain special characters in the `description` field without quotes. These same files work fine in Claude Code. ## Error Message ``` ConfigFrontmatterError: ConfigFrontmatterError data: { path: "/path/to/.claude/skills/commit-push-pr/SKILL.md", message: "Failed to parse YAML frontmatter: incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 3, column 37" } ``` This causes the SDK to receive an empty/malformed response, leading to: ``` Error: Unexpected end of JSON input at <anonymous> (../sdk/js/src/v2/gen/client/client.gen.ts:167:33) ``` ## Reproduction Create a SKILL.md with this frontmatter: ```yaml --- name: my-skill description: Quick workflow: commit + push. Triggers: "快速提交", "submit directly". --- ``` **Problematic characters:** - `: ` (colon + space) - YAML interprets as key-value separator - `"..."` (embedded quotes) - conflicts with YAML string syntax - `→` (unicode arrows) - some parsers choke on these ## Expected Behavior OpenCode should either: 1. Use a more lenient YAML parser (like Claude Code does) 2. Provide a clear, actionable error message instead of crashing 3. Gracefully skip malformed skills with a warning ## Comparison with Claude Code | Tool | Parser | Behavior | |------|--------|----------| | **Claude Code** | Simple regex/text matching | Parses successfully (lenient) | | **OpenCode** | `js-yaml` (strict) | Crashes with JSON error | ## Workaround Wrap `description` in single quotes: ```yaml description: 'Quick workflow: commit + push. Triggers: "快速提交".' ``` But this shouldn't be required if the content is valid for lenient parsers. ## Environment - OpenCode version: 1.1.18 - OS: macOS - Plugin: opencode-antigravity-auth ## Suggested Fix 1. Add try-catch around YAML parsing with descriptive error messages 2. Consider using a more lenient parser or fallback parsing strategy 3. Don't let frontmatter parsing failures cascade into JSON parsing errors --- 🤖 Generated with [Claude Code](https://claude.ai/claude-code)
yindo closed this issue 2026-02-16 17:53:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5523