[GH-ISSUE #5402] [Bug] Incomplete firmware ranges omit the missing argument from error details #3272

Closed
opened 2026-10-31 00:38:38 +00:00 by bsakaguchi · 2 comments
Owner

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

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

extract-firmware with only --offset or only --length exits 1 with invalid_request, but the JSON omits which companion option is missing. Its remediation says to correct the listed arguments without listing any arguments or reasons. Invalid input is correctly refused; the defect is missing correction information.

Reproduction

In the prebuilt source checkout at the revision below, the independent verifier used an empty local firmware.bin and ran:

verify_root=$(mktemp -d)
: > "$verify_root/firmware.bin"
node scripts/rea.mjs extract-firmware --help
node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-offset" --offset 5 --json
node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-length" --length 5 --json
node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-paired" --offset 5 --length 5 --json

Each invocation was executed once, with home/XDG directories, configuration, temporary storage and compile cache isolated. Help exited 0 and documented the companion-option requirement. Both incomplete ranges exited 1 with the JSON below and empty stderr. No firmware engine or external service was needed.

The paired-option control also exited 1 on this host, but reached provider admission and returned capability_unavailable for unblob, identifying its Linux and absolute caller-supplied tool-path requirements. This establishes that the complete range passed request validation; it does not establish successful extraction.

Expected behavior

Keep rejecting an incomplete range, while identifying the missing length for offset-only input or the missing offset for length-only input, with enough information to correct it.

Source-derived contract: AGENTS.md:31 requires preserving meaningful failure reasons. src/cli/firmwareCommands.ts:66-83 documents the range pairing, confirmed by executed help; src/domain/firmware/firmwareAnalysis.ts:7-8,30-32 requires both range fields. The existing generic input-error sentence is intentional (docs/user-visible-errors.csv, identifier 20); this report concerns lost correction details rather than replacing that sentence or exposing raw validator internals.

Impact and scope

P3 diagnostic defect: both tested incomplete ranges reproduced once. Requests remain rejected with the correct classification and exit status. Help provides a practical workaround by documenting that both options are required, and the paired-option control passed request validation. No incorrect analysis result, data change or security boundary crossing was demonstrated. MCP, other output formats and real firmware extraction were not tested.

REA version

6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8.

Runtime and platform

Node.js v26.12.0; macOS (darwin), arm64. No analysis provider was run.

Target and artifact context

Empty local firmware input, sufficient because incomplete ranges fail request validation before provider execution. No sensitive target data was used.

Interface

CLI

Earliest failure stage

Request parsing or validation

Relevant output or evidence

Both independently executed incomplete-range invocations returned exactly:

{"code":"invalid_request","category":"invalid_input","message":"Analysis input is invalid. Check the arguments and try again.","retryable":true,"remediation":{"action":"Correct the listed arguments and retry."}}

There is no details field or other indication of which argument failed. The distinct paired-option result above confirms these failures occur before provider admission.

Typed outcome or recovery expected

Retain invalid_request, invalid_input and exit 1, while preserving the missing companion field and a useful correction reason. No exact issue-path prefix or new message wording is required. Preserve the separate provider-admission outcome for the complete-range control.

Analysis or suspected cause

Source-derived reasoning: src/application/firmware/FirmwareAnalysisService.ts:32-37 constructs AnalysisInputError with the schema error as its cause but no correction issues. src/domain/analysisErrorCore.ts:69-75 defaults those issues to an empty list; src/domain/analysisErrorProjection.ts:312-329 emits argument details only for a nonempty list. This trace explains the observed omission.

Additional context

Prepared with AI assistance and independently reproduced before submission. Comparing the cited files against current upstream main e84468c0bb0476412ac0c8161f7c2ecc9a6864ca found no changes since the tested baseline; no runtime reproduction on that later revision is claimed.

Related #2180 concerns browser/Inspector CLI handlers, and merged #1089 concerns managed/reconstruction workflows. Neither covers firmware request validation. #5398 concerns pre-handler CLI parser wording and raw validator details; these firmware invocations pass CLI argument parsing and fail at the application request boundary instead.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5402 ### 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 `extract-firmware` with only `--offset` or only `--length` exits 1 with `invalid_request`, but the JSON omits which companion option is missing. Its remediation says to correct the listed arguments without listing any arguments or reasons. Invalid input is correctly refused; the defect is missing correction information. ### Reproduction In the prebuilt source checkout at the revision below, the independent verifier used an empty local `firmware.bin` and ran: ```bash verify_root=$(mktemp -d) : > "$verify_root/firmware.bin" node scripts/rea.mjs extract-firmware --help node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-offset" --offset 5 --json node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-length" --length 5 --json node scripts/rea.mjs extract-firmware "$verify_root/firmware.bin" "$verify_root/out-paired" --offset 5 --length 5 --json ``` Each invocation was executed once, with home/XDG directories, configuration, temporary storage and compile cache isolated. Help exited 0 and documented the companion-option requirement. Both incomplete ranges exited 1 with the JSON below and empty stderr. No firmware engine or external service was needed. The paired-option control also exited 1 on this host, but reached provider admission and returned `capability_unavailable` for `unblob`, identifying its Linux and absolute caller-supplied tool-path requirements. This establishes that the complete range passed request validation; it does not establish successful extraction. ### Expected behavior Keep rejecting an incomplete range, while identifying the missing length for offset-only input or the missing offset for length-only input, with enough information to correct it. Source-derived contract: `AGENTS.md:31` requires preserving meaningful failure reasons. `src/cli/firmwareCommands.ts:66-83` documents the range pairing, confirmed by executed help; `src/domain/firmware/firmwareAnalysis.ts:7-8,30-32` requires both range fields. The existing generic input-error sentence is intentional (`docs/user-visible-errors.csv`, identifier 20); this report concerns lost correction details rather than replacing that sentence or exposing raw validator internals. ### Impact and scope P3 diagnostic defect: both tested incomplete ranges reproduced once. Requests remain rejected with the correct classification and exit status. Help provides a practical workaround by documenting that both options are required, and the paired-option control passed request validation. No incorrect analysis result, data change or security boundary crossing was demonstrated. MCP, other output formats and real firmware extraction were not tested. ### REA version 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`. ### Runtime and platform Node.js v26.12.0; macOS (darwin), arm64. No analysis provider was run. ### Target and artifact context Empty local firmware input, sufficient because incomplete ranges fail request validation before provider execution. No sensitive target data was used. ### Interface CLI ### Earliest failure stage Request parsing or validation ### Relevant output or evidence Both independently executed incomplete-range invocations returned exactly: ```json {"code":"invalid_request","category":"invalid_input","message":"Analysis input is invalid. Check the arguments and try again.","retryable":true,"remediation":{"action":"Correct the listed arguments and retry."}} ``` There is no `details` field or other indication of which argument failed. The distinct paired-option result above confirms these failures occur before provider admission. ### Typed outcome or recovery expected Retain `invalid_request`, `invalid_input` and exit 1, while preserving the missing companion field and a useful correction reason. No exact issue-path prefix or new message wording is required. Preserve the separate provider-admission outcome for the complete-range control. ### Analysis or suspected cause Source-derived reasoning: `src/application/firmware/FirmwareAnalysisService.ts:32-37` constructs `AnalysisInputError` with the schema error as its cause but no correction issues. `src/domain/analysisErrorCore.ts:69-75` defaults those issues to an empty list; `src/domain/analysisErrorProjection.ts:312-329` emits argument details only for a nonempty list. This trace explains the observed omission. ### Additional context Prepared with AI assistance and independently reproduced before submission. Comparing the cited files against current upstream main `e84468c0bb0476412ac0c8161f7c2ecc9a6864ca` found no changes since the tested baseline; no runtime reproduction on that later revision is claimed. Related #2180 concerns browser/Inspector CLI handlers, and merged #1089 concerns managed/reconstruction workflows. Neither covers firmware request validation. #5398 concerns pre-handler CLI parser wording and raw validator details; these firmware invocations pass CLI argument parsing and fail at the application request boundary instead.
Author
Owner

@CassieFox23 commented on GitHub (Oct 21, 2026):

Thanks, coygeek, for the paired control. From reading main at 01788bac8, not a run: this looks fixed. Commit 1629266e3c on 2026-10-21 names this issue. It added tests/boundary/cli/firmwareIncompleteRange.test.ts. That test expects details.issues with path ["input", "range", "length"] or ["input", "range", "offset"]. It also expects reason missing_argument and retryable false. The "input" prefix in that path is what #5877 now reports. Closing is the maintainers' call.

🤖 Written with Claude Code (Fable 5.1, verified by Opus 5.5), posted with my OK 🦊

<!-- gh-comment-id:6321742583 --> @CassieFox23 commented on GitHub (Oct 21, 2026): Thanks, coygeek, for the paired control. From reading main at 01788bac8, not a run: this looks fixed. Commit 1629266e3c on 2026-10-21 names this issue. It added `tests/boundary/cli/firmwareIncompleteRange.test.ts`. That test expects `details.issues` with path `["input", "range", "length"]` or `["input", "range", "offset"]`. It also expects reason `missing_argument` and `retryable` false. The "input" prefix in that path is what #5877 now reports. Closing is the maintainers' call. 🤖 Written with Claude Code (Fable 5.1, verified by Opus 5.5), posted with my OK 🦊
Author
Owner

@morluto commented on GitHub (Oct 21, 2026):

Closing as fixed on main by github.com/morluto/rea@1629266e3c, retained at 67a6477f01.

Firmware range schema failures now retain the missing companion argument in structured error details. The public CLI regression covers both incomplete pairs and requires missing_argument, invalid_request, non-retryable status and schema-valid errors before provider work.

This audit inspected the current producer, regression source, issue discussion and main ancestry. Tests/runtime reproductions were not rerun, and no additional real-provider or platform coverage is implied.

<!-- gh-comment-id:6324345536 --> @morluto commented on GitHub (Oct 21, 2026): Closing as fixed on main by https://github.com/morluto/rea/commit/1629266e3c08c90fed6bba5383528af7986a12b7, retained at 67a6477f011ae358fc333e5a6e26c86d932654ed. Firmware range schema failures now retain the missing companion argument in structured error details. The public CLI regression covers both incomplete pairs and requires missing_argument, invalid_request, non-retryable status and schema-valid errors before provider work. This audit inspected the current producer, regression source, issue discussion and main ancestry. Tests/runtime reproductions were not rerun, and no additional real-provider or platform coverage is implied.
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#3272
No description provided.