Skip to content

[BUG]: Invalid agent/mode config files: agent crashes startup, mode silently disappears #27133

Closed as not planned

Description

@EClinick

Description

A schema-invalid file in .opencode/agent/ and the same file in .opencode/mode/ produce very different results. A bad agent file throws ConfigInvalidError and breaks startup (4 different requests fail, no agent load at all). A bad mode file is silently dropped from the mode list with no error, log, or hint that anything was wrong.

Both behaviors are in packages/opencode/src/config/agent.ts load() calls ConfigParse.schema(....) which throws; loadMode() uses Schema.decodeUnkownExit and it just skips invalid entries. Ideally, as a user, both should surface an error and continue loading the rest of the files. So there's an inconsistency with the error handling of these two loading mechanisms.

Plugins

No response

OpenCode version

1.14.48 (built from source, dev branch at commit 549b146e

Steps to reproduce

Steps to Repro:

  1. In an empty dir, create .opencode/agent/good.md and .opencode/mode/good.md with valid frontmatter (e.g temperature: 0.5).
  2. Create .opencode/agent/broken.md and .opencode/mode/broken.md with temperature: "not a valid number".
  3. Run bun dev <dir you added agent and mode files> or opencode <dir you added agent and mode files>.

Startup will fail with 4 of 5 requests failed: ConfigInvalidError. No agents load.

If you delete agent/broken.md and rerun. Startup succeeds, but the broken mode is missing from the mode list, it'll show a good mode due to good.md but broken mode is silently missing with no error displayed.

Expected:

I'd expect both bad files to produce a visible error; and be consistent. My personal preference would be for it load opencode, but display an error upon start showing md file xyz (in this case broken.md) is invalid and won't load.

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Git Bash

Activity

  1. added a commit that references this issue on May 28, 2026
    79f3a5c
  2. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions