anomalyco / anomalyco/opencode

Agent .md files with invalid YAML frontmatter are silently skipped without warning

Open
#45,876 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When a custom agent markdown file (for example .opencode/agents/test.md or ~/.config/opencode/agents/test.md) contains invalid YAML frontmatter — such as an indentation error — the file is silently skipped. The user sees no warning, no error, and no indication that the agent failed to load.

This is inconsistent with skill loading, which logs an error and publishes a Session.Event.Error when a skill file fails to parse.

Reproduction steps
  1. Create .opencode/agents/test.md with malformed frontmatter indentation:

    ---
     name: test
      description: test agent
    ---
    
    You are a helpful assistant.
    
  2. Start OpenCode or run opencode agent list.

  3. Observe that test does not appear, and no warning or error is shown.

Root cause

In packages/opencode/src/config/agent.ts, the parse result is swallowed:

const md = await ConfigMarkdown.parse(item).catch(() => undefined)
if (!md) continue

Any FrontmatterError thrown by ConfigMarkdown.parse() is discarded, and the agent is simply omitted.

Expected behavior

At minimum, a warning should be logged so the user knows:

  • which file failed
  • why it failed
  • that the agent was skipped

Ideally, this should behave similarly to skill parse failures: log the error with context and, when possible, surface it to the user.

Related
  • #24181 (closed as stale) — described a related problem where invalid YAML caused the agent to load with degraded config.
Environment
  • OpenCode version: current dev branch
  • Bun 1.3+

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.