[GH-ISSUE #4940] [Bug] Claude Code setup reports ready for JSONC that native Claude Code rejects #3066

Closed
opened 2026-10-31 00:35:48 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @xu91102 on GitHub (Oct 18, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4940

Before submitting

  • I searched open and closed issues and related production diffs.
  • This report contains only self-authored configuration fixtures and no credentials.

Area

Setup, packaging, or upgrade; CLI. Earliest failure: setup/configuration admission.

Observed behavior

rea setup --client claude_code --skill=false --yes --json reports ready and configured for .claude.json containing a comment or trailing comma. The emitted configuration retains the unsupported syntax. rea doctor --client claude_code --json then reports the registration aligned.

Native Claude Code 2.1.263 rejects both the original fixture and an independent copy of REA's emitted file as corrupt JSON. This is a configuration-admission mismatch, before an agent can use the registration.

Reproduction

In an isolated home/config directory, write this .claude.json:

{
  // preserve this unrelated setting
  "mcpServers": {
    "peer": { "command": "/usr/bin/true", "args": [] }
  }
}
  1. Set HOME and CLAUDE_CONFIG_DIR to that isolated directory.
  2. Run rea setup --client claude_code --skill=false --dry-run --json: exit 0, planned, original bytes unchanged.
  3. Run rea setup --client claude_code --skill=false --yes --json: exit 0, ready; the backup is byte-exact, but the result still contains the comment.
  4. Run rea doctor --client claude_code --json: registration aligned.
  5. In a separate isolated directory, give native claude mcp get peer an exact copy of the original or emitted file. Both exit 1 with JSON Parse error: Unrecognized token '/'.

A trailing comma instead of the comment produces the same REA outcomes; native Claude reports Property name must be a string literal. Plain JSON and BOM-prefixed plain JSON controls are accepted by both readers. Immutable source fixtures remain unchanged; native Claude's own backup/migration writes are confined to its independent copies. Its valid control attempts to connect only to the self-owned /usr/bin/true fixture, which intentionally has no MCP handshake.

Expected behavior and recovery

Setup should reject syntax the selected native client cannot load before creating a backup or changing its configuration. Doctor should identify malformed configuration instead of declaring it aligned. Keep Claude Code's observed BOM support and keep JSONC support for clients such as Cursor; do not silently reformat or discard the caller's settings.

Impact and scope

Two distinct malformed native inputs reproduced the false-ready result, with two positive controls. The shared reader currently routes Claude Code's json format through JSONC admission with comments and trailing commas enabled. This differs from the TOML Int64 problem in #4917 and from the private project-registration selection in #2414.

No original file was lost in the REA trials; backups were exact. No full Claude agent/model session, Claude Desktop, Windows or Linux validation was performed. Native CLI configuration admission was tested, not a successful MCP conversation.

REA version and environment

Compiled latest-main revision 847472acf5cf4a28379e828dcd0fe55ac99d7c07 (6.5.0 source), Node 24.18.0, macOS 27.0.1 arm64; native Claude Code 2.1.263. Also reproduced on earlier main d5fc7e6ebf9af050081fc4c6e18b9079cfaa5cdc.

Relevant evidence

The latest-main CLI runs each returned ready/configured for the comment and trailing-comma fixtures; both native original/emitted-copy trials rejected them. Positive plain/BOM JSON trials succeeded. The producing boundary is src/application/ClientConfigurationDocument.ts (parseDocument), shared by setup and registration diagnosis.

An initial exploratory run invoked native Claude before REA on the same copy, which allowed native migration writes to contaminate that comparison. That run is excluded from the same-byte reproduction above; the reported results use immutable inputs and separate homes.

Local repair validation

A focused repair is normally committed and pushed to my fork: 21f27279, based on main 847472ac. The shared configuration parser now selects native-compatible Claude Code JSON by client identity, and setup/doctor/uninstall consumers all carry that identity. Invalid syntax is refused before writes/backups; valid JSON and an initial BOM, absent-file creation, peers and existing recovery backups remain supported. Cursor JSONC and Pi/Kimi dialects retain their existing behavior.

Local validation: 307 distinct tests passed (13 unchanged file inputs plus fresh corrected BOM/README results, not one final all-file run), required check/docs/discovery/package gates passed, and two independent frozen-source reviews passed. One immutable installed tarball passed 62 distinct CLI configuration lifecycle controls across Claude Code and other-client grammar controls. Native Claude Code 2.1.263 mcp get ran 12 distinct controls on independent copies: six invalid-syntax rejections, three actual REA connections and three confirmed absences after uninstall. A prior driver assertion expected different missing-registration wording; that harness failure is retained and excluded from duplicate counts.

These results cover macOS arm64 configuration and MCP connection probes. Full agent/model/tool workflows, Claude Desktop, native Cursor/Pi/Kimi, Windows/Linux and performance were not run. There is no upstream PR or hosted CI for this fork repair yet. Later main b33c0df0 has identical relevant inputs; it was not integrated or fully runtime qualified.

Duplicate implementation check

I have now read the complete five-file patch of #4944 at 877c2022cdea14371a295ec1cb03be41da8dfba2 (OPEN and not merged at this read). It changes the same shared document-admission owner to strict Claude Code JSON after an optional BOM. I am keeping my frozen fork branch read-only and will not open a duplicate PR or repackage the remaining empty-file/lifecycle coverage as a separate root. My earlier validation remains evidence for my exact fork head; I have not run that PR's head or certified all of its behavior. No adoption of my source, authorship credit, upstream PR or hosted CI is being claimed.

Update (2026-10-18 03:10 UTC): #4944 was merged at 02:57:28Z as main 18aa9af2b2c26fd114113dd39528a91224801840, and this issue was closed at 02:57:29Z. I read the complete actual merge patch: it fixes the same Claude Code strict-JSON/optional-BOM parser root using a dedicated client format. My fork remains a read-only preparation; I have no upstream PR, merge or author credit for this fix, and adoption of my fork source is not established. I have not run the merged head; the validation above remains limited to my original frozen fork baseline. I will not submit a duplicate or repackage remaining empty-file/metadata/lifecycle differences.

Originally created by @xu91102 on GitHub (Oct 18, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4940 ### Before submitting - [x] I searched open and closed issues and related production diffs. - [x] This report contains only self-authored configuration fixtures and no credentials. ### Area Setup, packaging, or upgrade; CLI. Earliest failure: setup/configuration admission. ### Observed behavior `rea setup --client claude_code --skill=false --yes --json` reports `ready` and `configured` for `.claude.json` containing a comment or trailing comma. The emitted configuration retains the unsupported syntax. `rea doctor --client claude_code --json` then reports the registration `aligned`. Native Claude Code 2.1.263 rejects both the original fixture and an independent copy of REA's emitted file as corrupt JSON. This is a configuration-admission mismatch, before an agent can use the registration. ### Reproduction In an isolated home/config directory, write this `.claude.json`: ```jsonc { // preserve this unrelated setting "mcpServers": { "peer": { "command": "/usr/bin/true", "args": [] } } } ``` 1. Set `HOME` and `CLAUDE_CONFIG_DIR` to that isolated directory. 2. Run `rea setup --client claude_code --skill=false --dry-run --json`: exit 0, `planned`, original bytes unchanged. 3. Run `rea setup --client claude_code --skill=false --yes --json`: exit 0, `ready`; the backup is byte-exact, but the result still contains the comment. 4. Run `rea doctor --client claude_code --json`: registration `aligned`. 5. In a separate isolated directory, give native `claude mcp get peer` an exact copy of the original or emitted file. Both exit 1 with `JSON Parse error: Unrecognized token '/'`. A trailing comma instead of the comment produces the same REA outcomes; native Claude reports `Property name must be a string literal`. Plain JSON and BOM-prefixed plain JSON controls are accepted by both readers. Immutable source fixtures remain unchanged; native Claude's own backup/migration writes are confined to its independent copies. Its valid control attempts to connect only to the self-owned `/usr/bin/true` fixture, which intentionally has no MCP handshake. ### Expected behavior and recovery Setup should reject syntax the selected native client cannot load before creating a backup or changing its configuration. Doctor should identify malformed configuration instead of declaring it aligned. Keep Claude Code's observed BOM support and keep JSONC support for clients such as Cursor; do not silently reformat or discard the caller's settings. ### Impact and scope Two distinct malformed native inputs reproduced the false-ready result, with two positive controls. The shared reader currently routes Claude Code's `json` format through JSONC admission with comments and trailing commas enabled. This differs from the TOML Int64 problem in #4917 and from the private project-registration selection in #2414. No original file was lost in the REA trials; backups were exact. No full Claude agent/model session, Claude Desktop, Windows or Linux validation was performed. Native CLI configuration admission was tested, not a successful MCP conversation. ### REA version and environment Compiled latest-main revision `847472acf5cf4a28379e828dcd0fe55ac99d7c07` (6.5.0 source), Node 24.18.0, macOS 27.0.1 arm64; native Claude Code 2.1.263. Also reproduced on earlier main `d5fc7e6ebf9af050081fc4c6e18b9079cfaa5cdc`. ### Relevant evidence The latest-main CLI runs each returned `ready`/`configured` for the comment and trailing-comma fixtures; both native original/emitted-copy trials rejected them. Positive plain/BOM JSON trials succeeded. The producing boundary is `src/application/ClientConfigurationDocument.ts` (`parseDocument`), shared by setup and registration diagnosis. An initial exploratory run invoked native Claude before REA on the same copy, which allowed native migration writes to contaminate that comparison. That run is excluded from the same-byte reproduction above; the reported results use immutable inputs and separate homes. ### Local repair validation A focused repair is normally committed and pushed to my fork: [21f27279](https://github.com/xu91102/rea/commit/21f27279acd9c54cf5bf2198a6a6421f2c767a19), based on main `847472ac`. The shared configuration parser now selects native-compatible Claude Code JSON by client identity, and setup/doctor/uninstall consumers all carry that identity. Invalid syntax is refused before writes/backups; valid JSON and an initial BOM, absent-file creation, peers and existing recovery backups remain supported. Cursor JSONC and Pi/Kimi dialects retain their existing behavior. Local validation: 307 distinct tests passed (13 unchanged file inputs plus fresh corrected BOM/README results, not one final all-file run), required check/docs/discovery/package gates passed, and two independent frozen-source reviews passed. One immutable installed tarball passed 62 distinct CLI configuration lifecycle controls across Claude Code and other-client grammar controls. Native Claude Code 2.1.263 `mcp get` ran 12 distinct controls on independent copies: six invalid-syntax rejections, three actual REA connections and three confirmed absences after uninstall. A prior driver assertion expected different missing-registration wording; that harness failure is retained and excluded from duplicate counts. These results cover macOS arm64 configuration and MCP connection probes. Full agent/model/tool workflows, Claude Desktop, native Cursor/Pi/Kimi, Windows/Linux and performance were not run. There is no upstream PR or hosted CI for this fork repair yet. Later main `b33c0df0` has identical relevant inputs; it was not integrated or fully runtime qualified. ### Duplicate implementation check I have now read the complete five-file patch of [#4944](https://github.com/morluto/rea/pull/4944) at `877c2022cdea14371a295ec1cb03be41da8dfba2` (OPEN and not merged at this read). It changes the same shared document-admission owner to strict Claude Code JSON after an optional BOM. I am keeping my frozen fork branch read-only and will not open a duplicate PR or repackage the remaining empty-file/lifecycle coverage as a separate root. My earlier validation remains evidence for my exact fork head; I have not run that PR's head or certified all of its behavior. No adoption of my source, authorship credit, upstream PR or hosted CI is being claimed. Update (2026-10-18 03:10 UTC): #4944 was merged at 02:57:28Z as main `18aa9af2b2c26fd114113dd39528a91224801840`, and this issue was closed at 02:57:29Z. I read the complete actual merge patch: it fixes the same Claude Code strict-JSON/optional-BOM parser root using a dedicated client format. My fork remains a read-only preparation; I have no upstream PR, merge or author credit for this fix, and adoption of my fork source is not established. I have not run the merged head; the validation above remains limited to my original frozen fork baseline. I will not submit a duplicate or repackage remaining empty-file/metadata/lifecycle differences.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3066
No description provided.