[GH-ISSUE #2152] [Bug] setup and uninstall misdescribe a client config whose root or server table is not an object #706

Closed
opened 2026-10-15 18:27:34 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @kaoru0822-kitauji on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2152

Observed behavior

When a client configuration parses but has the wrong shape, setup and uninstall describe the problem wrongly. Examples: {"mcpServers": null}, a JSON array root [], or "mcpServers": "x".

  • rea setup: prints a raw Zod issue dump that does not name the offending key:
    $ rea setup --client cursor --yes      # ~/.cursor/mcp.json is {"mcpServers": null, "keep": 1}
    status: needs_human
    remediation: Cursor: Configuration …/.cursor/mcp.json is malformed: [
      {
        "expected": "record",
        "code": "invalid_type",
        "path": [],
        "message": "Invalid input: expected record, received null"
      }
    ]
    
  • rea uninstall: reports a parse error that did not happen:
    cursor,failed,Configuration is not valid JSON and was not changed. Repair it, then rerun uninstall.
    

Both files are valid JSON. The actual problem is that the root, or the mcpServers value, is not an object. Nothing was modified in either case, which is correct.

Reproduction

Isolated HOME on current main 60259a91d: write {"mcpServers": null, "keep": 1} or [] to $HOME/.cursor/mcp.json, then run rea setup --client cursor --yes and rea uninstall.

Expected behavior

Both commands name the structural problem, for example "mcpServers" must be an object or "the configuration root must be an object". uninstall says "not valid JSON" only when the text does not parse.

Cause

parseClientConfiguration (src/application/ClientConfigurationDocument.ts) validates the root and the servers value with objectSchema.parse, which throws a ZodError. readConfigurationFile interpolates ZodError.message (the JSON issue list) into the setup detail. The uninstall reader (src/application/Uninstall.ts) discards the cause and always reports Configuration is not valid <format>.

Originally created by @kaoru0822-kitauji on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2152 ### Observed behavior When a client configuration parses but has the wrong shape, `setup` and `uninstall` describe the problem wrongly. Examples: `{"mcpServers": null}`, a JSON array root `[]`, or `"mcpServers": "x"`. - **`rea setup`:** prints a raw Zod issue dump that does not name the offending key: ```text $ rea setup --client cursor --yes # ~/.cursor/mcp.json is {"mcpServers": null, "keep": 1} status: needs_human remediation: Cursor: Configuration …/.cursor/mcp.json is malformed: [ { "expected": "record", "code": "invalid_type", "path": [], "message": "Invalid input: expected record, received null" } ] ``` - **`rea uninstall`:** reports a parse error that did not happen: ```text cursor,failed,Configuration is not valid JSON and was not changed. Repair it, then rerun uninstall. ``` Both files are valid JSON. The actual problem is that the root, or the `mcpServers` value, is not an object. Nothing was modified in either case, which is correct. ### Reproduction Isolated HOME on current main 60259a91d: write `{"mcpServers": null, "keep": 1}` or `[]` to `$HOME/.cursor/mcp.json`, then run `rea setup --client cursor --yes` and `rea uninstall`. ### Expected behavior Both commands name the structural problem, for example `"mcpServers" must be an object` or "the configuration root must be an object". `uninstall` says "not valid JSON" only when the text does not parse. ### Cause `parseClientConfiguration` (`src/application/ClientConfigurationDocument.ts`) validates the root and the servers value with `objectSchema.parse`, which throws a `ZodError`. `readConfigurationFile` interpolates `ZodError.message` (the JSON issue list) into the setup detail. The uninstall reader (`src/application/Uninstall.ts`) discards the cause and always reports `Configuration is not valid <format>`.
bsakaguchi 2026-10-15 18:27:34 +00:00
  • closed this issue
  • added the
    bug
    label
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#706
No description provided.