You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Config schema should tolerate unknown fields instead of failing all session loading #33196
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
When the opencode config file (opencode.json / opencode.jsonc) contains a root-level field that is not defined in the Config schema (e.g., "files": {}), opencode throws ConfigInvalidError and refuses to load all sessions.
The Config JSON Schema uses "additionalProperties": false at the root level, so any unrecognized property causes a fatal validation error. This is overly fragile: a single misplaced key should produce a warning, not crash the entire application.
Suggested approach:
Unknown properties should be logged as warnings and skipped (warn-and-skip)
Either relax additionalProperties at the root level, or explicitly ignore unrecognized fields during config parsing
If a config section is invalid, skip that section and continue with defaults for the rest
Show a non-blocking notification ("Unknown config field 'files' – ignoring") instead of crashing session loading
changed the title [-]Config schema should tolerate unknown fields instead of failing all session loading with ConfigInvalidError[/-][+][FEATURE]: Config schema should tolerate unknown fields instead of failing all session loading[/+]on Jun 21, 2026
The config loader should produce partial config plus structured warnings. Unknown root keys can emit config.warning with JSON path, schema version, and ignored value type; invalid known sections can fall back to defaults for that section.
Session loading should only fail for errors that make runtime unsafe, such as malformed JSON or invalid required provider credentials. A regression should prove one stray root key does not block session list, resume, or new-session creation.
This isn't hypothetical — we have concrete evidence. In the current stable code (packages/opencode/src/config/parse.ts:40-47), topLevelExtraKeys() throws an InvalidError with code "unrecognized_keys" for any root-level key not in the Config schema:
We had a config file with "files": {} at root level, which is not a known Config key — this immediately blocked all session loading. The schema has no index signatures, so any stray key triggers the error.
Activity
[-]Config schema should tolerate unknown fields instead of failing all session loading with ConfigInvalidError[/-][+][FEATURE]: Config schema should tolerate unknown fields instead of failing all session loading[/+]Necmttn commentedon Jun 21, 2026
The config loader should produce partial config plus structured warnings. Unknown root keys can emit
config.warningwith JSON path, schema version, and ignored value type; invalid known sections can fall back to defaults for that section.Session loading should only fail for errors that make runtime unsafe, such as malformed JSON or invalid required provider credentials. A regression should prove one stray root key does not block session list, resume, or new-session creation.
Generated with ax.
mouse114514 commentedon Jun 22, 2026
This isn't hypothetical — we have concrete evidence. In the current stable code (
packages/opencode/src/config/parse.ts:40-47),topLevelExtraKeys()throws anInvalidErrorwith code"unrecognized_keys"for any root-level key not in the Config schema:We had a config file with
"files": {}at root level, which is not a known Config key — this immediately blocked all session loading. The schema has no index signatures, so any stray key triggers the error.github-actions commentedon Aug 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.