Skip to content

Windows: every ASAR analysis fails with artifact_operation_failed (platform path separators not handled in AsarArtifactReader) #570

Closed

Description

@rishiteja21

Environment

  • rea-agents 3.2.1 (npm)
  • Node.js v24.20.0, Windows 11 x64 (build 26300)
  • @electron/asar 4.2.0

Summary

On Windows, analyze_javascript_application (and rea analyze) fails for every .asar with:

{
  "code": "artifact_operation_failed",
  "category": "execution_failure",
  "message": "Artifact is invalid or has changed. Get a fresh copy and try again.",
  "details": { "operation": "analyze_javascript_application", "reason": "format" }
}

The archive is valid — npx @electron/asar list app.asar enumerates all entries fine. No valid ASAR can be analyzed on Windows.

Root cause

AsarArtifactReader.entries() (src/artifacts/AsarArtifactReader.ts):

  1. listPackage (line 30) returns entry paths using the platform separator, with a leading separator — on Windows: \node_modules, \node_modules\@formatjs, …
  2. Line 34 strips only forward slashes:
    const path = listed.replace(/^\/+|\/+$/gu, "");
    so on Windows the leading \ survives (\node_modules).
  3. Line 38 passes that key to statFile(this.path, path, false). @electron/asar's Filesystem.getFile splits lookup keys on path.sep (\ on Windows), so the key \node_modules resolves to an empty first component and fails with '"\node_modules" was not found in this archive'. asarFailure wraps this into a format failure, which surfaces as the generic artifact_operation_failed above.
  4. adapterKey (line 69) keeps the same malformed key, so extractFile would fail the same way.

On macOS/Linux listPackage emits /node_modules/..., the regex strips the leading /, and lookups succeed — hence Windows-only.

Fix

Normalize separators and use path.sep for @electron/asar lookups while keeping graph-facing paths POSIX. The following patch (applied to the installed dist) was verified: rea analyze on a real 118 MB Electron app.asar proceeds past inventory and completes:

import { sep } from "node:path";

const path = listed.replace(/^[\/]+|[\/]+$/gu, "").replace(/\/gu, "/");
...
metadata = statFile(this.path, path.split("/").join(sep), false);
...
adapterKey: path.split("/").join(sep),

Related observation (separate cause, also blocks Windows use)

rea doctor --json fails on Windows with spawn EINVAL: RuntimeExecutableDiagnostics discovers .CMD/.BAT candidates (npm.cmd, npx.cmd) on PATH and spawns them without shell, which Node.js (≥20.12) rejects with EINVAL. Diagnostics-only, but it hides the capability matrix on Windows.

Activity

  1. added
    bug
    area: build
    on Oct 12, 2026
  2. added
    area: evidence
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: buildarea: evidencebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions