stablyai/orca · critical
[verify-packaged-daemon-entry] packaged daemon-entry.js fail
Error message
[verify-packaged-daemon-entry] packaged daemon-entry.js failed to load under plain Node:
${stderr} What it means
Thrown by the packaged daemon entry verification script when daemon-entry.js was successfully launched under plain Node but its stderr output contains 'Cannot find module' or 'MODULE_NOT_FOUND'. This indicates a bundling regression: the packaged daemon entry's dependency graph is incomplete and references modules that weren't bundled or aren't resolvable. The comment at line 23 references v1.4.129-rc.1 which shipped exactly this class of bug (an Electron `require` leaked into the daemon bundle).
Source
Thrown at config/scripts/verify-packaged-daemon-entry.cjs:45
// users. Module-load proof only: with no args the entry must reach argv parsing
// and print its "Usage: daemon-entry" error — a MODULE_NOT_FOUND or a missing
// usage line means the packaged graph does not load and the build must fail.
//
// resourcesDir is the packaged Resources dir (Contents/Resources on macOS,
// <appOutDir>/resources elsewhere). execPath defaults to the packaging Node.
function verifyPackagedDaemonEntryBoots(resourcesDir, options = {}) {
const execPath = options.execPath || process.execPath
const entryPath = assertPackagedDaemonEntryExists(resourcesDir)
const result = spawnSync(execPath, [entryPath], { encoding: 'utf8', timeout: 10_000 })
if (result.error) {
throw new Error(
`[verify-packaged-daemon-entry] could not launch daemon-entry.js: ${result.error.message}`
)
}
const stderr = result.stderr || ''
if (/Cannot find module|MODULE_NOT_FOUND/.test(stderr)) {
throw new Error(
`[verify-packaged-daemon-entry] packaged daemon-entry.js failed to load under plain Node:\n${stderr}`
)
}
if (!stderr.includes('Usage: daemon-entry')) {
throw new Error(
`[verify-packaged-daemon-entry] packaged daemon-entry.js did not reach argv parsing ` +
`(expected the "Usage: daemon-entry" error). stderr:\n${stderr}`
)
}
console.log('[verify-packaged-daemon-entry] OK — packaged daemon-entry loads under plain Node')
}
module.exports = { assertPackagedDaemonEntryExists, verifyPackagedDaemonEntryBoots }
View on GitHub (pinned to 1136503c6a)
Solutions
- Read the stderr output in the error message — it names the exact module that could not be found.
- If the module is 'electron' or an Electron-only package, ensure the daemon entry bundle does not import it; the daemon runs under plain Node, not Electron's runtime.
- Check the esbuild/webpack config for the daemon entry build target and ensure all runtime dependencies are bundled (not externalized).
- Run the daemon-entry bundle locally under plain Node to reproduce: node out/main/daemon-entry.js and observe the MODULE_NOT_FOUND error.
- If the missing module is a legitimate Node built-in, verify the Node version used for verification matches the one the bundle targets.
Example fix
// before — esbuild config marks too many packages as external // external: ['electron', 'chokidar', 'node-pty'] // // after — only electron is truly external for the daemon bundle // external: ['electron']
Defensive patterns
Strategy: validation
Validate before calling
// Before packaging, test the daemon entry bundle loads under plain Node.
const { spawnSync } = require('node:child_process')
function preCheckDaemonBundleLoads(entryPath) {
const result = spawnSync(process.execPath, [entryPath], {
encoding: 'utf8',
timeout: 10_000
})
const stderr = result.stderr || ''
if (/Cannot find module|MODULE_NOT_FOUND/.test(stderr)) {
const match = stderr.match(/Cannot find module '([^']+)'/)
return {
ok: false,
missingModule: match ? match[1] : 'unknown',
stderr
}
}
return { ok: true }
} Prevention
- Run the daemon entry bundle under plain Node (not Electron) as a separate CI step before packaging to catch module resolution issues early.
- Review the esbuild/webpack external array for the daemon entry build target — only 'electron' should be external, not Node built-ins or bundled dependencies.
- When adding a new import to the daemon entry or its transitive dependencies, verify it doesn't pull in Electron-only modules by checking the bundle output.
When it happens
Trigger: The daemon-entry.js bundle was produced by esbuild/webpack but an externalized dependency was not marked as bundleable, leaving a runtime require that resolves under Electron's module system but not under plain Node. The verification deliberately runs under plain Node (not Electron) to catch this: Electron-specific requires like 'electron' itself or main-process-only modules fail to resolve.
Common situations: An esbuild external array was over-broad and excluded a dependency that should have been bundled; a new import was added to the daemon entry or its transitive dependencies that pulls in an Electron-only module; the bundler config marks 'electron' as external (correct for the main process bundle) but the daemon entry was incorrectly placed in the same build target; a Node version difference where a built-in module name changed.
Related errors
- [verify-packaged-daemon-entry] could not launch daemon-entry
- [verify-packaged-daemon-entry] packaged daemon-entry.js did
- [plain-node-entry-guard] daemon-entry.js failed to load unde
- [verify-packaged-daemon-entry] missing unpacked daemon entry
- [plain-node-entry-guard] "${entryName}" reaches chunk "${chu
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/c6e0c5417bd0a461.
Report an issue: GitHub.