anomalyco / anomalyco/opencode
Agent .md files with invalid YAML frontmatter are silently skipped without warning
@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
-
Create
.opencode/agents/test.mdwith malformed frontmatter indentation:--- name: test description: test agent --- You are a helpful assistant. -
Start OpenCode or run
opencode agent list. -
Observe that
testdoes 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
devbranch - Bun 1.3+
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.