{"record":{"id":"54ac1a070a8c2173","repo":"can1357/oh-my-pi","slug":"failed-to-read-unpacked-asar-file-label-de","errorCode":null,"errorMessage":"Failed to read unpacked ASAR file '${label}': ${describeError(error)}","messagePattern":"Failed to read unpacked ASAR file '(.+?)': (.+?)","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/asar.ts","lineNumber":171,"sourceCode":"\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}\n\t\tverifyIntegrity(bytes, this.#integrity, memberPath);\n\t\treturn bytes;\n\t}\n}\n\nasync function readAsarIndex(source: ByteSource, options: FormatReadOptions): Promise<ArchiveIndexEntry[]> {\n\tif (!Number.isSafeInteger(source.size) || source.size < ASAR_JSON_OFFSET) {\n\t\tthrow invalidAsar(\"truncated header\");\n\t}\n\n\tconst sizePickle = await source.read(0, ASAR_PICKLE_PREFIX_SIZE);\n\tif (sizePickle.byteLength !== ASAR_PICKLE_PREFIX_SIZE) {\n\t\tthrow invalidAsar(\"truncated size pickle\");\n\t}","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/asar.ts#L153-L189","documentation":"Wraps an unexpected I/O error from reading the unpacked sidecar file's bytes (after stat succeeded). The original error message is embedded via describeError so the underlying cause (permissions, EBUSY, etc.) is preserved in an ArchiveError.","triggerScenarios":"Bun.file(path).bytes() rejecting with a non-ENOENT error: EACCES/EPERM on the file, EIO, file locked by another process, or a race where the file is deleted between stat and read.","commonSituations":"Running the app as a user without read permission on .unpacked contents; antivirus/indexers holding the file; NFS/network volumes dropping the file mid-read; SELinux or sandbox restrictions.","solutions":["Check file permissions on the .unpacked tree (readable by the process user) and fix with chmod/chown","Inspect the embedded cause message for the exact errno and address it (disk, lock, permission)","Retest with security software / filesystem overlays disabled to rule out interference"],"exampleFix":"// before\nchmod 600 app.asar.unpacked/assets/*\n// after\nchmod -R u+r app.asar.unpacked/","handlingStrategy":"try-catch","validationCode":"try { await fs.access(sidecar, fs.constants.R_OK); } catch { throw new Error(`no read permission on ${sidecar}`); }","typeGuard":null,"tryCatchPattern":"try { return await readMember(entry); } catch (e) { if (e instanceof ArchiveError && e.message.startsWith(\"Failed to read unpacked ASAR file\")) { logger.error(\"sidecar read failed\", { cause: e.message }); } throw e; }","preventionTips":["Ensure the process user can read the entire .unpacked tree","Exclude .unpacked from overzealous antivirus/backup locks","Handle embedded errno from the wrapped cause message"],"tags":["asar","io-error","filesystem","permissions"],"backgroundTag":"file-read-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}