{"record":{"id":"f2550abf55df8447","repo":"can1357/oh-my-pi","slug":"unpacked-asar-file-label-was-not-found","errorCode":null,"errorMessage":"Unpacked ASAR file '${label}' was not found","messagePattern":"Unpacked ASAR file '(.+?)' was not found","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/asar.ts","lineNumber":157,"sourceCode":"\treadonly #integrity?: AsarIntegrity;\n\n\tconstructor(filePath: string | undefined, size: number, integrity: AsarIntegrity | undefined) {\n\t\tthis.#filePath = filePath;\n\t\tthis.#size = size;\n\t\tthis.#integrity = integrity;\n\t}\n\n\tasync read(size: number, memberPath: string): Promise<Uint8Array> {\n\t\tconst label = formatArchivePathForError(memberPath);\n\t\tif (size !== this.#size) {\n\t\t\tthrow new ArchiveError(`ASAR member '${label}' has an inconsistent size`);\n\t\t}\n\t\tif (!this.#filePath) {\n\t\t\tthrow new ArchiveError(`Archive file '${label}' is unpacked and requires a filesystem-backed ASAR archive`);\n\t\t}\n\t\tconst file = Bun.file(this.#filePath);\n\t\tconst stat = await file.stat().catch(() => {\n\t\t\tthrow new ArchiveError(`Unpacked ASAR file '${label}' was not found`);\n\t\t});\n\t\tif (stat.isDirectory()) {\n\t\t\tthrow new ArchiveError(`Unpacked ASAR file '${label}' is a directory`);\n\t\t}\n\t\tif (stat.size !== this.#size) {\n\t\t\tthrow new ArchiveError(\n\t\t\t\t`Unpacked ASAR file '${label}' size differs from its archive header (${stat.size} != ${this.#size} bytes)`,\n\t\t\t);\n\t\t}\n\t\tlet bytes: Uint8Array;\n\t\ttry {\n\t\t\tbytes = await file.bytes();\n\t\t} catch (error) {\n\t\t\tthrow new ArchiveError(`Failed to read unpacked ASAR file '${label}': ${describeError(error)}`);\n\t\t}\n\t\tif (bytes.byteLength !== this.#size) {\n\t\t\tthrow new ArchiveError(`Unpacked ASAR file '${label}' changed while being read`);\n\t\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/asar.ts#L139-L175","documentation":"Thrown when the unpacked sidecar file for an ASAR member (computed as `<archivePath>.unpacked/<member path>`) does not exist on disk — Bun.file().stat() rejected. The header says the member is unpacked, but the corresponding external file is absent.","triggerScenarios":"Reading an unpacked ASAR member whose `<asar>.unpacked/...` counterpart is missing; distributing the .asar without its .unpacked directory; the unpacked file was deleted or renamed.","commonSituations":"Incomplete app deployments that copy app.asar but not app.asar.unpacked; build pipelines stripping the sidecar directory; antivirus or cleanup jobs deleting files; wrong archivePath passed so the sidecar path resolves elsewhere.","solutions":["Verify the `<name>.asar.unpacked/` directory exists next to the archive and contains the member path","Fix your deployment/copy step to include the .unpacked directory (e.g. `cp -r app.asar*` instead of only app.asar)","Repack the archive with the file packed inside if the sidecar layout is not wanted"],"exampleFix":"// before\ncp app.asar /deploy/app.asar\n// after\ncp -r app.asar app.asar.unpacked /deploy/","handlingStrategy":"try-catch","validationCode":"const sidecar = `${asarPath}.unpacked/${entry.path}`;\nif (entry.unpacked && !(await Bun.file(sidecar).exists())) throw new Error(`missing sidecar: ${sidecar}`);","typeGuard":null,"tryCatchPattern":"try { return await readMember(entry); } catch (e) { if (e instanceof ArchiveError && e.message.includes(\"was not found\")) { console.error(`Missing .unpacked sidecar for ${entry.path}; reinstall the package`); } throw e; }","preventionTips":["Always copy app.asar* (including the .unpacked dir) during deploy","Add a post-install check that iterates unpacked entries and stats their sidecars","Keep .asar and .unpacked in the same directory"],"tags":["asar","unpacked-files","missing-file","filesystem","electron"],"backgroundTag":"file-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}