{"record":{"id":"40cfadf615e97bd3","repo":"stablyai/orca","slug":"verify-packaged-daemon-entry-could-not-launch-da","errorCode":null,"errorMessage":"[verify-packaged-daemon-entry] could not launch daemon-entry.js: ${result.error.message}","messagePattern":"\\[verify-packaged-daemon-entry\\] could not launch daemon-entry\\.js: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/scripts/verify-packaged-daemon-entry.cjs","lineNumber":39,"sourceCode":"}\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.\nfunction verifyPackagedDaemonEntryBoots(resourcesDir, options = {}) {\n  const execPath = options.execPath || process.execPath\n  const entryPath = assertPackagedDaemonEntryExists(resourcesDir)\n\n  const result = spawnSync(execPath, [entryPath], { encoding: 'utf8', timeout: 10_000 })\n  if (result.error) {\n    throw new Error(\n      `[verify-packaged-daemon-entry] could not launch daemon-entry.js: ${result.error.message}`\n    )\n  }\n  const stderr = result.stderr || ''\n  if (/Cannot find module|MODULE_NOT_FOUND/.test(stderr)) {\n    throw new Error(\n      `[verify-packaged-daemon-entry] packaged daemon-entry.js failed to load under plain Node:\\n${stderr}`\n    )\n  }\n  if (!stderr.includes('Usage: daemon-entry')) {\n    throw new Error(\n      `[verify-packaged-daemon-entry] packaged daemon-entry.js did not reach argv parsing ` +\n        `(expected the \"Usage: daemon-entry\" error). stderr:\\n${stderr}`\n    )\n  }\n  console.log('[verify-packaged-daemon-entry] OK — packaged daemon-entry loads under plain Node')\n}\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/verify-packaged-daemon-entry.cjs#L21-L57","documentation":"Thrown by the packaged daemon entry verification script when spawnSync(execPath, [entryPath]) returns a result with an error property set. This means Node.js could not even spawn the process to run daemon-entry.js — the failure is at the OS/process level (e.g., the execPath binary doesn't exist, the entry file permissions prevent execution, or the system is out of resources), not a JavaScript module-loading failure.","triggerScenarios":"The execPath (defaults to process.execPath, i.e. the Node binary running the verification) doesn't exist or isn't executable at the resolved path; the entryPath file has restrictive permissions; a broken symlink at the entry path; the OS refused to fork the process (out of memory, too many processes).","commonSituations":"Running the verification inside a CI container where the Node binary path differs from what process.execPath resolved to at packaging time; the packaged app was built on a different OS and the entry file has wrong permissions; a disk-full or resource-exhausted CI runner; the asar-unpacked path is a dangling symlink.","solutions":["Inspect result.error.message in the thrown error — for ENOENT it indicates which path is missing, for EACCES it's a permissions issue.","Verify process.execPath points to a valid, executable Node binary: ls -la $(which node).","Check file permissions on the entry path: it must be readable by the process running the verification.","If running in a container, ensure the Node binary and the packaged resources are both present and accessible inside the container filesystem."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the Node binary is executable before spawning.\nconst { existsSync, accessSync, constants } = require('node:fs')\n\nfunction preCheckExecPath(execPath) {\n  if (!existsSync(execPath)) {\n    throw new Error(`execPath does not exist: ${execPath}`)\n  }\n  try {\n    accessSync(execPath, constants.X_OK)\n  } catch {\n    throw new Error(`execPath is not executable: ${execPath}`)\n  }\n}","typeGuard":null,"tryCatchPattern":"// spawnSync errors are at the OS level; distinguish ENOENT from EACCES.\ntry {\n  verifyPackagedDaemonEntryBoots(resourcesDir)\n} catch (error) {\n  if (error.message.includes('could not launch')) {\n    // OS-level failure — check binary, permissions, or container setup\n    console.error('Launch failure — verify execPath and file permissions:', error.message)\n  }\n  throw error\n}","preventionTips":["In containerized CI, verify process.execPath resolves to a real binary inside the container, not a host path leaked through volume mounts.","Check that the packaged resources directory has correct read permissions for the CI user."],"tags":["electron-packaging","daemon","spawn","ci-gate","filesystem"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}