{"record":{"id":"13b1c7c2bfe630d7","repo":"stablyai/orca","slug":"plain-node-entry-guard-guarded-missing-map-na","errorCode":null,"errorMessage":"[plain-node-entry-guard] guarded ${missing.map((name) => `\"${name}\"`).join(', ')} ${missing.length === 1 ? 'is not a rollup input' : 'are not rollup inputs'} anymore. Update PLAIN_NODE_ENTRY_NAMES/WORKER_THREAD_ENTRY_NAMES in plain-node-entry-guard.ts to the current entry names — a stale name silently stops guarding that entry.","messagePattern":"\\[plain-node-entry-guard\\] guarded (.+?)\"`\\)\\.join\\(', '\\)\\} (.+?) anymore\\. Update PLAIN_NODE_ENTRY_NAMES/WORKER_THREAD_ENTRY_NAMES in plain-node-entry-guard\\.ts to the current entry names — a stale name silently stops guarding that entry\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/build-plugins/plain-node-entry-guard.ts","lineNumber":66,"sourceCode":"  ...WORKER_THREAD_ENTRY_NAMES\n] as const\n\ntype EntryRuntime = 'plain-Node process' | 'worker thread'\n\n// Subpaths (electron/main) are as unloadable as the bare module under plain Node.\nconst ELECTRON_REQUIRE_RE = /require\\(\\s*[\"'`]electron(?:\\/[^\"'`]+)?[\"'`]\\s*\\)/\n\n// Why: writeBundle skips any name missing from the bundle, so a renamed or\n// removed rollup input would silently drop that entry from the guard and let the\n// regression back in. Pin the lists to the input keys at build start instead.\nfunction assertEntryNamesAreRollupInputs(input: NormalizedInputOptions['input']): void {\n  if (typeof input === 'string' || Array.isArray(input)) {\n    return\n  }\n  const inputNames = new Set(Object.keys(input))\n  const missing = GUARDED_ENTRY_NAMES.filter((name) => !inputNames.has(name))\n  if (missing.length > 0) {\n    throw new Error(\n      `[plain-node-entry-guard] guarded ${missing.map((name) => `\"${name}\"`).join(', ')} ` +\n        `${missing.length === 1 ? 'is not a rollup input' : 'are not rollup inputs'} anymore. ` +\n        `Update PLAIN_NODE_ENTRY_NAMES/WORKER_THREAD_ENTRY_NAMES in plain-node-entry-guard.ts to ` +\n        `the current entry names — a stale name silently stops guarding that entry.`\n    )\n  }\n}\n\nfunction collectReachableChunks(\n  entry: OutputChunk,\n  byFileName: Map<string, OutputChunk>\n): OutputChunk[] {\n  const seen = new Set<string>()\n  const reachable: OutputChunk[] = []\n  const stack = [entry.fileName]\n  while (stack.length > 0) {\n    const fileName = stack.pop() as string\n    if (seen.has(fileName)) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/build-plugins/plain-node-entry-guard.ts#L48-L84","documentation":"A Vite/Rollup build plugin guard (`assertEntryNamesAreRollupInputs`) fires at buildStart when any name in GUARDED_ENTRY_NAMES (the hardcoded lists PLAIN_NODE_ENTRY_NAMES and WORKER_THREAD_ENTRY_NAMES) is absent from the actual rollup input keys. The guard exists because writeBundle silently skips names that aren't in the bundle, so a renamed or removed entry would silently stop being checked — re-introducing the v1.4.129-rc.1 daemon outage class. The build aborts so you fix the list before the regression ships.","triggerScenarios":"Renaming a rollup input key in electron.vite.config.ts (e.g. changing 'daemon-entry' to 'daemon') without updating the corresponding entry in PLAIN_NODE_ENTRY_NAMES or WORKER_THREAD_ENTRY_NAMES in plain-node-entry-guard.ts. Also fires when removing an entry from the rollup input object without removing it from the guard lists.","commonSituations":"Refactoring the main process entry points in electron.vite.config.ts:208 (the rollupOptions.input object). Adding or removing a forked process entry, worker thread entry, or renaming an existing one. The guard list is maintained by hand against the rollup input keys, so any naming drift between the two triggers this.","solutions":["Read the error message: it names exactly which entries are missing (the `${missing}` list). For each missing name, either rename it in the guard list to match the new rollup input key, or remove it from PLAIN_NODE_ENTRY_NAMES/WORKER_THREAD_ENTRY_NAMES if the entry was intentionally deleted.","Open electron.vite.config.ts:208 and compare the keys in the `input` object against GUARDED_ENTRY_NAMES in plain-node-entry-guard.ts:46 — every guarded name must appear as an input key.","If you added a new plain-Node or worker-thread entry, add its name to the appropriate list so it stays guarded against electron require leaks."],"exampleFix":"// before — rollup input in electron.vite.config.ts\ndaemon-entry: resolve('src/main/daemon/daemon-entry.ts')\n// after (renamed to 'daemon')\ndaemon: resolve('src/main/daemon/daemon-entry.ts')\n\n// plain-node-entry-guard.ts — must also update:\n// before\nconst PLAIN_NODE_ENTRY_NAMES = ['daemon-entry', ...] as const\n// after\nconst PLAIN_NODE_ENTRY_NAMES = ['daemon', ...] as const","handlingStrategy":"validation","validationCode":"// Run before the build to verify guard lists match rollup inputs\nimport { readFileSync } from 'fs'\nconst config = readFileSync('electron.vite.config.ts', 'utf8')\nconst guard = readFileSync('config/build-plugins/plain-node-entry-guard.ts', 'utf8')\nconst inputKeys = [...config.matchAll(/^(\\S[\\w/-]+):\\s*resolve\\(/gm)].map(m => m[1])\nconst guardNames = [...guard.matchAll(/'([\\w/-]+)'/g)].map(m => m[1])\nconst stale = guardNames.filter(n => !inputKeys.includes(n))\nif (stale.length) console.warn('Stale guard entries:', stale)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When renaming a rollup input key, grep for the old name across config/ to find all references including the guard lists.","Keep PLAIN_NODE_ENTRY_NAMES and WORKER_THREAD_ENTRY_NAMES directly beside the rollup input config or add a test that cross-checks them (the test at plain-node-entry-guard.test.ts:136 already covers this).","Treat the guard lists as part of the build contract — any PR that changes rollup input keys must update them in the same commit."],"tags":["build-config","rollup","vite","entry-points","guard"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}