Skip to content

Unexpected silent merge of opencode.json and opencode.jsonc — partial overrides without warning #32447

@escoffie

Description

@escoffie

Description

When both opencode.json and opencode.jsonc exist in the config directory, OpenCode silently merges them. A partial .jsonc can override specific keys from a full .json without any indication to the user.

In my case, opencode.json had the correct MCP config for Engram:

"engram": {
  "command": ["/usr/local/bin/engram", "mcp", "--tools=agent"]
}

But opencode.jsonc (leftover from a previous setup) had:

"engram": {
  "command": ["/usr/local/Cellar/engram/1.16.1/bin/engram", "mcp", "--tools=agent"]
}

This caused a confusing ENOENT error pointing to a path that didn't exist (1.16.1), even though the .json file was correct.
Expected
Either:

  1. Document the precedence/merge behavior clearly (which file wins when both exist?)
  2. Warn when a partial config overrides specific keys from the other file
  3. Or discourage having two config files with conflicting MCP entries
    Additional context
    The error message (ENOENT: no such file or directory, posix_spawn '/usr/local/Cellar/engram/1.16.1/bin/engram') didn't hint that the problem was a stale config file or a merge conflict — it looked like a missing binary.

Plugins

engram.ts, model-variants.ts, skill-registry.ts, gentle-logo.tsx

OpenCode version

1.17.7

Steps to reproduce

  1. Create ~/.config/opencode/opencode.json with a correct MCP entry:
"mcp": {
  "engram": {
    "command": ["/usr/local/bin/engram", "mcp"],
    "type": "local"
  }
}
  1. Create ~/.config/opencode/opencode.jsonc with a partial override of the same MCP server pointing to a non-existent path:
"mcp": {
  "engram": {
    "command": ["/usr/local/Cellar/engram/1.16.1/bin/engram", "mcp"],
    "type": "local"
  }
}
  1. Launch OpenCode.
  2. Observed: the MCP server silently fails with ENOENT. No warning that a second config file exists, no indication of the merge happening, and no hint about which file takes precedence.

Screenshot and/or share link

Image

Operating System

MacOS 26.5.1

Terminal

iTerm2 Build 3.6.11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions