{"record":{"id":"5045351f8d564206","repo":"stablyai/orca","slug":"verify-packaged-daemon-entry-missing-unpacked-da","errorCode":null,"errorMessage":"[verify-packaged-daemon-entry] missing unpacked daemon entry at ${entryPath} — asarUnpack expects out/main/daemon-entry.js on every platform, so the packaged daemon cannot be forked from this layout","messagePattern":"\\[verify-packaged-daemon-entry\\] missing unpacked daemon entry at (.+?) — asarUnpack expects out/main/daemon-entry\\.js on every platform, so the packaged daemon cannot be forked from this layout","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/scripts/verify-packaged-daemon-entry.cjs","lineNumber":14,"sourceCode":"const { existsSync } = require('node:fs')\nconst { spawnSync } = require('node:child_process')\nconst { join } = require('node:path')\n\n// Why: `asarUnpack` in config/electron-builder.config.cjs lists\n// out/main/daemon-entry.js on every platform, and the packaged daemon fork\n// (src/main/daemon/daemon-init.ts) resolves exactly this unpacked path. A\n// missing entry means the package layout regressed, so the check throws\n// instead of skipping — a silent skip false-passed exactly the layout bug\n// this gate exists to catch.\nfunction assertPackagedDaemonEntryExists(resourcesDir) {\n  const entryPath = join(resourcesDir, 'app.asar.unpacked', 'out', 'main', 'daemon-entry.js')\n  if (!existsSync(entryPath)) {\n    throw new Error(\n      `[verify-packaged-daemon-entry] missing unpacked daemon entry at ${entryPath} — ` +\n        `asarUnpack expects out/main/daemon-entry.js on every platform, so the packaged ` +\n        `daemon cannot be forked from this layout`\n    )\n  }\n  return entryPath\n}\n\n// Why: v1.4.129-rc.1 shipped a terminal daemon that could not load (an electron\n// `require` leaked into its bundle) while every build check passed. This boots\n// the PACKAGED daemon-entry under plain Node against the asar-unpacked layout,\n// so a bundling / asar-unpack regression fails packaging instead of reaching\n// users. Module-load proof only: with no args the entry must reach argv parsing\n// and print its \"Usage: daemon-entry\" error — a MODULE_NOT_FOUND or a missing\n// usage line means the packaged graph does not load and the build must fail.\n//\n// resourcesDir is the packaged Resources dir (Contents/Resources on macOS,\n// <appOutDir>/resources elsewhere). execPath defaults to the packaging Node.","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/verify-packaged-daemon-entry.cjs#L1-L32","documentation":"Thrown by the packaged daemon entry verification script when the file app.asar.unpacked/out/main/daemon-entry.js does not exist inside the packaged Resources directory. The script checks this path because electron-builder's asarUnpack config lists out/main/daemon-entry.js on every platform, and the runtime daemon fork (src/main/daemon/daemon-init.ts) resolves exactly this unpacked path. A missing file means the packaged layout regressed and the daemon cannot be forked at runtime.","triggerScenarios":"Running verifyPackagedDaemonEntryExists(resourcesDir) against a packaged app where the build output at out/main/daemon-entry.js was not produced, or the asarUnpack glob in electron-builder.config.cjs was changed and no longer matches it. Can also occur if the build step that generates daemon-entry.js (esbuild/webpack bundling) was skipped or failed silently.","commonSituations":"A refactor renamed daemon-entry.js to something else but the asarUnpack config was not updated; the bundling step for the daemon entry was removed from the build pipeline; the file exists in the source tree but the build didn't emit it to out/main/; running the verification against a partially-built or stale package output directory.","solutions":["Check that out/main/daemon-entry.js exists in the build output: ls out/main/daemon-entry.js","Verify the asarUnpack array in config/electron-builder.config.cjs still includes 'out/main/daemon-entry.js'.","Rebuild the project to regenerate the daemon entry bundle, then re-package.","If the daemon entry file was intentionally renamed, update both the asarUnpack glob and the daemon-init.ts resolver path to match."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before calling verifyPackagedDaemonEntryExists, check the build output exists.\nconst { existsSync } = require('node:fs')\nconst { join } = require('node:path')\n\nfunction preCheckDaemonEntry(buildOutDir) {\n  const entrySrc = join(buildOutDir, 'main', 'daemon-entry.js')\n  if (!existsSync(entrySrc)) {\n    return {\n      ok: false,\n      message: `daemon-entry.js not found at ${entrySrc} — rebuild the project before packaging.`\n    }\n  }\n  return { ok: true }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the full build (including daemon entry bundling) before packaging and before running this verification.","Keep the asarUnpack glob in electron-builder.config.cjs in sync with the actual build output filename for daemon-entry.","Add a CI step that checks out/main/daemon-entry.js exists immediately after the build, separate from the packaging verification."],"tags":["electron-packaging","daemon","asar-unpack","build-gate","electron-builder"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}