Skip to content

OpenCode: op=mcp_install still refuses the write on v0.10.4 after the .jsonc targeting fix #1630

Description

@DeusData

Filed from discussion #1560, where this has been reported by two people on two operating systems and has no tracking issue. Reproduced on v0.10.4, today's release.

Symptom

error: agent_config agent=OpenCode op=mcp_install path=/home/<user>/.config/opencode/opencode.jsonc

The whole activation then exits 1, even when the other clients configured successfully.

Why this is not #1560's .jsonc targeting bug

PR #1575 fixed which file we target: OpenCode reads either opencode.json or opencode.jsonc, we always wrote the .json name, so a user with a .jsonc config got a second file OpenCode ignores. That fix is real and it shipped in v0.10.4.

The write still refuses. We now pick the correct file and then fail to write it. So the targeting was necessary but not sufficient, and the v0.10.4 release notes overstate it — I have a correction to make there.

Reporters and scope

  • @iandol — Linux, ~/.config/opencode/opencode.jsonc, fails on 0.10.3 and 0.10.4
  • @gotspatel — Windows, the same op=mcp_install against a .json config

Leading hypothesis

The JSON editor cannot parse a real .jsonc file. JSONC permits // and /* */ comments and trailing commas; a strict JSON parser refuses all three, and the editor fails closed on anything it cannot model. That would explain a correctly-targeted file being refused, and would also explain the Windows .json case if that file carries comments too.

Not yet confirmed — it needs the reporter's actual file, which is why this is an issue rather than a PR.

What would make this diagnosable

#1629 makes the refusal report what the target is (kind and size), which separates "structural refusal" from a permissions or missing-file problem. The real fix is for the editors to carry their own refusal reason out, the way cbm_daemon_ipc_validation_detail() already does for the daemon — nine distinct fail-closed conditions currently collapse into a single -1.

Asks

@iandol, @gotspatel — if you are willing: the first ~20 lines of your opencode.jsonc / opencode.json (redact anything private), and specifically whether it contains comments or trailing commas. That would confirm or kill the hypothesis immediately.

With apologies that this has taken several releases. You have both been unusually patient and precise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor/integrationEditor compatibility and CLI integrationwindowsWindows-specific issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions