[GH-ISSUE #6521] [Bug] recover_javascript_sources fails with a raw EEXIST when two selected inputs collide #3913

Closed
opened 2026-10-31 00:45:12 +00:00 by bsakaguchi · 0 comments
Owner

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

Before submitting

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

Area

Evidence, artifacts, or reconstruction

Observed behavior

recover_javascript_sources fails with a raw Node Error: EEXIST: file already exists instead of a typed REA error when two selected inputs map to the same snapshot path. That happens when the same file is selected twice (for example in path and again in additional_paths), or when two names differ only in letter case on a case-insensitive filesystem such as the default Windows and macOS ones.

Reproduction

Ran on Linux (WSL Ubuntu, Node 24.22.1) at upstream/main 28a33cae8, through snapshotRecoveryInputs in a test:

  1. Create bundle.js in a temporary directory.
  2. Call snapshotRecoveryInputs([bundle, bundle], snapshotDirectory).
  3. The call rejects with Error: EEXIST: file already exists, open …, not an AnalysisInputError.

The case-only variant (bundle.js and BUNDLE.js) was run with the temporary directory on a case-insensitive NTFS mount and fails the same way.

Expected behavior

An input error on additional_paths that names the colliding input and asks the caller to select each file once.

Impact and scope

Agents and CLI users who list a file twice, or whose related chunk names differ only in case on Windows or macOS, get an unexpected internal failure with no guidance. No partial recovery runs.

REA version

6.7.0, revision 28a33cae8

Runtime and platform

Linux (WSL Ubuntu), Node 24.22.1; case variant on NTFS through WSL

Target and artifact context

A one-line local JavaScript file; no real bundle.

Interface

MCP

Earliest failure stage

Artifact or evidence registration

Relevant output or evidence

expected Error: EEXIST: file already exists, open … to be an instance of AnalysisInputError

src/javascript/recovery/RecoveryFiles.ts, snapshotRecoveryInput:

await mkdir(dirname(snapshotPath), { recursive: true, mode: 0o700 });
await writeFile(snapshotPath, bytes, { flag: "wx", mode: 0o600 });

Typed outcome or recovery expected

AnalysisInputError with an issue on additional_paths.

Analysis or suspected cause

The snapshot directory starts empty, so EEXIST (or ENOTDIR for a file/directory name clash) at this write can only mean another selected input took the same relative path. The exclusive write already detects it; the error is just not translated.

Additional context

Fixed by #6520.

Originally created by @Adolanium on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6521 ### 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 Evidence, artifacts, or reconstruction ### Observed behavior `recover_javascript_sources` fails with a raw Node `Error: EEXIST: file already exists` instead of a typed REA error when two selected inputs map to the same snapshot path. That happens when the same file is selected twice (for example in `path` and again in `additional_paths`), or when two names differ only in letter case on a case-insensitive filesystem such as the default Windows and macOS ones. ### Reproduction Ran on Linux (WSL Ubuntu, Node 24.22.1) at upstream/main 28a33cae8, through `snapshotRecoveryInputs` in a test: 1. Create `bundle.js` in a temporary directory. 2. Call `snapshotRecoveryInputs([bundle, bundle], snapshotDirectory)`. 3. The call rejects with `Error: EEXIST: file already exists, open …`, not an `AnalysisInputError`. The case-only variant (`bundle.js` and `BUNDLE.js`) was run with the temporary directory on a case-insensitive NTFS mount and fails the same way. ### Expected behavior An input error on `additional_paths` that names the colliding input and asks the caller to select each file once. ### Impact and scope Agents and CLI users who list a file twice, or whose related chunk names differ only in case on Windows or macOS, get an unexpected internal failure with no guidance. No partial recovery runs. ### REA version 6.7.0, revision `28a33cae8` ### Runtime and platform Linux (WSL Ubuntu), Node 24.22.1; case variant on NTFS through WSL ### Target and artifact context A one-line local JavaScript file; no real bundle. ### Interface MCP ### Earliest failure stage Artifact or evidence registration ### Relevant output or evidence ``` expected Error: EEXIST: file already exists, open … to be an instance of AnalysisInputError ``` `src/javascript/recovery/RecoveryFiles.ts`, `snapshotRecoveryInput`: ```ts await mkdir(dirname(snapshotPath), { recursive: true, mode: 0o700 }); await writeFile(snapshotPath, bytes, { flag: "wx", mode: 0o600 }); ``` ### Typed outcome or recovery expected `AnalysisInputError` with an issue on `additional_paths`. ### Analysis or suspected cause The snapshot directory starts empty, so `EEXIST` (or `ENOTDIR` for a file/directory name clash) at this write can only mean another selected input took the same relative path. The exclusive write already detects it; the error is just not translated. ### Additional context Fixed by #6520.
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#3913
No description provided.