[GH-ISSUE #6455] [Bug] mcp doctor returns VALIDATION_ERROR for a missing --format value #3870

Closed
opened 2026-10-31 00:44:47 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6455

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

CLI

Observed behavior

node scripts/rea.mjs mcp doctor --format and mcp doctor --format= exit 1 with VALIDATION_ERROR, although missing output values are documented to return MISSING_OUTPUT_VALUE. The same two options on capabilities return the documented code. Adding --json before the missing format preserves valid JSON but leaves the wrong code.

Reproduction

Start in a fresh source checkout at the revision below. Preparation instructions:

git checkout 9eb829aca34be36ff112826337996f6139f82eff
npm ci && npm run build:cached
WORK=$(mktemp -d)
mkdir -p "$WORK/home"
export HOME="$WORK/home"

Run:

node scripts/rea.mjs mcp doctor --format
node scripts/rea.mjs mcp doctor --format=
node scripts/rea.mjs capabilities --format
node scripts/rea.mjs capabilities --format=
node scripts/rea.mjs mcp doctor --json --format
node scripts/rea.mjs mcp doctor --json --format=

Each command was observed twice per runtime listed below, using an existing built checkout, isolated HOME and captured stdout/stderr. Every run exited 1 with empty stderr. No fixture, analysis target, provider or external service is needed. Fresh dependency installation and rebuilding are preparation instructions, not checks performed for these observations.

Expected behavior

Return MISSING_OUTPUT_VALUE for both absent and explicitly empty format values, before starting the diagnostic. The CLI output contract explicitly names that code for missing valued output flags. The command's observed help advertises --format <toon|json|yaml|md|jsonl>; its option declaration includes the format selector.

Impact and scope

P2: bounded inconsistency in a documented machine-readable error classification. Callers branching on MISSING_OUTPUT_VALUE receive a generic validation code instead. Both malformed forms consistently reproduced; the failure status remains correct and the caller can supply a complete format value. No downstream consumer failure was executed. Only the commands listed here were tested; broader command coverage is unknown.

REA version

6.7.0 (source 9eb829aca3)

Runtime and platform

Node.js v24.22.1 and v26.12.1; macOS 27.0.1; arm64. Both runtimes produced the same results. The exact repository Node.js pin, 24.18.0, was not tested. No Hopper or Ghidra provider was used.

Target and artifact context

Not applicable: target-free CLI argument validation.

Interface

CLI

Earliest failure stage

Request parsing or validation

Relevant output or evidence

Observed stdout for mcp doctor --format:

code: VALIDATION_ERROR
message: "Invalid output format: missing"

For mcp doctor --format=, the message is Invalid output format: with an empty suffix and the same code. With preceding --json, the first case returns:

{"code":"VALIDATION_ERROR","message":"Invalid output format: missing"}

Both capabilities controls return:

{"ok":false,"error":{"code":"MISSING_OUTPUT_VALUE","message":"--format requires a value, as in --format <value> or --format=<value>."}}

Typed outcome or recovery expected

Distinguish a missing value from an unsupported format name. Preserve exit 1 and a useful missing-value explanation. The independently executed mcp doctor --json --format bogus control, run twice per runtime, returns VALIDATION_ERROR with Invalid output format: bogus; that is a present invalid value rather than a missing one.

Analysis or suspected cause

Source-derived: the doctor parser rejects undefined and empty candidates with its generic invalid-format branch. The dispatcher-facing error path always assigns VALIDATION_ERROR. The ordinary CLI missing-value path instead assigns MISSING_OUTPUT_VALUE.

Additional context

Related #5531 concerns invalid values losing JSON formatting; doctor already retains valid JSON in the explicit JSON cases above. Closed #5435 concerns JSON indentation. PR #2693 preserves selectors and envelopes on argument errors, but its current diff retains VALIDATION_ERROR for missing format values. None restores the documented missing-value classification.

NOT_ENOUGH_INFO: no last-known-good version was established. No fix or restoration was tested.

Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6455 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area CLI ### Observed behavior `node scripts/rea.mjs mcp doctor --format` and `mcp doctor --format=` exit 1 with `VALIDATION_ERROR`, although missing output values are documented to return `MISSING_OUTPUT_VALUE`. The same two options on `capabilities` return the documented code. Adding `--json` before the missing format preserves valid JSON but leaves the wrong code. ### Reproduction Start in a fresh source checkout at the revision below. Preparation instructions: ```sh git checkout 9eb829aca34be36ff112826337996f6139f82eff npm ci && npm run build:cached WORK=$(mktemp -d) mkdir -p "$WORK/home" export HOME="$WORK/home" ``` Run: ```sh node scripts/rea.mjs mcp doctor --format node scripts/rea.mjs mcp doctor --format= node scripts/rea.mjs capabilities --format node scripts/rea.mjs capabilities --format= node scripts/rea.mjs mcp doctor --json --format node scripts/rea.mjs mcp doctor --json --format= ``` Each command was observed twice per runtime listed below, using an existing built checkout, isolated HOME and captured stdout/stderr. Every run exited 1 with empty stderr. No fixture, analysis target, provider or external service is needed. Fresh dependency installation and rebuilding are preparation instructions, not checks performed for these observations. ### Expected behavior Return `MISSING_OUTPUT_VALUE` for both absent and explicitly empty format values, before starting the diagnostic. The [CLI output contract](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/docs/cli.md#L543) explicitly names that code for missing valued output flags. The command's observed help advertises `--format <toon|json|yaml|md|jsonl>`; its [option declaration](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/mcpDoctor.ts#L37) includes the format selector. ### Impact and scope P2: bounded inconsistency in a documented machine-readable error classification. Callers branching on `MISSING_OUTPUT_VALUE` receive a generic validation code instead. Both malformed forms consistently reproduced; the failure status remains correct and the caller can supply a complete format value. No downstream consumer failure was executed. Only the commands listed here were tested; broader command coverage is unknown. ### REA version 6.7.0 (source 9eb829aca34be36ff112826337996f6139f82eff) ### Runtime and platform Node.js v24.22.1 and v26.12.1; macOS 27.0.1; arm64. Both runtimes produced the same results. The exact repository Node.js pin, 24.18.0, was not tested. No Hopper or Ghidra provider was used. ### Target and artifact context Not applicable: target-free CLI argument validation. ### Interface CLI ### Earliest failure stage Request parsing or validation ### Relevant output or evidence Observed stdout for `mcp doctor --format`: ```text code: VALIDATION_ERROR message: "Invalid output format: missing" ``` For `mcp doctor --format=`, the message is `Invalid output format: ` with an empty suffix and the same code. With preceding `--json`, the first case returns: ```json {"code":"VALIDATION_ERROR","message":"Invalid output format: missing"} ``` Both capabilities controls return: ```json {"ok":false,"error":{"code":"MISSING_OUTPUT_VALUE","message":"--format requires a value, as in --format <value> or --format=<value>."}} ``` ### Typed outcome or recovery expected Distinguish a missing value from an unsupported format name. Preserve exit 1 and a useful missing-value explanation. The independently executed `mcp doctor --json --format bogus` control, run twice per runtime, returns `VALIDATION_ERROR` with `Invalid output format: bogus`; that is a present invalid value rather than a missing one. ### Analysis or suspected cause Source-derived: the [doctor parser](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/mcpDoctor.ts#L473) rejects undefined and empty candidates with its generic invalid-format branch. The [dispatcher-facing error path](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/mcpDoctor.ts#L335) always assigns `VALIDATION_ERROR`. The ordinary CLI [missing-value path](https://github.com/morluto/rea/blob/9eb829aca34be36ff112826337996f6139f82eff/src/cliOutput.ts#L270) instead assigns `MISSING_OUTPUT_VALUE`. ### Additional context Related #5531 concerns invalid values losing JSON formatting; doctor already retains valid JSON in the explicit JSON cases above. Closed #5435 concerns JSON indentation. PR #2693 preserves selectors and envelopes on argument errors, but its current diff retains `VALIDATION_ERROR` for missing format values. None restores the documented missing-value classification. NOT_ENOUGH_INFO: no last-known-good version was established. No fix or restoration was tested.
Author
Owner

@ezrabrilliant commented on GitHub (Oct 23, 2026):

I'd like to work on this. Plan: make mcp doctor report a missing or empty --format value as MISSING_OUTPUT_VALUE (as documented in docs/cli.md and already returned by capabilities), with a regression test in tests/boundary/cli/mcpDoctorHelpCli.test.ts. I'll open a PR shortly.

<!-- gh-comment-id:6358819571 --> @ezrabrilliant commented on GitHub (Oct 23, 2026): I'd like to work on this. Plan: make `mcp doctor` report a missing or empty `--format` value as `MISSING_OUTPUT_VALUE` (as documented in `docs/cli.md` and already returned by `capabilities`), with a regression test in `tests/boundary/cli/mcpDoctorHelpCli.test.ts`. I'll open a PR shortly.
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#3870
No description provided.