{"record":{"id":"7c88049e6ab802d3","repo":"stablyai/orca","slug":"codex-trust-grant-entry-bundle-not-found","errorCode":null,"errorMessage":"codex trust-grant entry bundle not found","messagePattern":"codex trust-grant entry bundle not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/main/codex/codex-app-server-grant-bridge.ts","lineNumber":90,"sourceCode":"  options: RunGrantSessionSyncOptions = {}\n): CodexHookTrustGrantSessionResult {\n  return runCodexAppServerEntrySync(request, options) as CodexHookTrustGrantSessionResult\n}\n\nexport function runCodexUserHookTrustRebaseSessionSync(\n  request: CodexUserHookTrustRebaseRequest,\n  options: RunGrantSessionSyncOptions = {}\n): CodexUserHookTrustRebaseResult {\n  return runCodexAppServerEntrySync(request, options) as CodexUserHookTrustRebaseResult\n}\n\nfunction runCodexAppServerEntrySync(\n  request: CodexAppServerEntryRequest,\n  options: RunGrantSessionSyncOptions\n): CodexAppServerEntryResult {\n  const entryPath = options.entryPath ?? resolveCodexGrantEntryPath()\n  if (!entryPath) {\n    throw new Error('codex trust-grant entry bundle not found')\n  }\n  const spawned = spawnSync(options.nodeCommand ?? process.execPath, [entryPath], {\n    input: JSON.stringify(request),\n    encoding: 'utf8',\n    timeout:\n      request.invocation.timeoutMs + (options.timeoutMarginMs ?? GRANT_ENTRY_TIMEOUT_MARGIN_MS),\n    killSignal: 'SIGKILL',\n    maxBuffer: GRANT_ENTRY_MAX_BUFFER_BYTES,\n    windowsHide: true,\n    env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' }\n  })\n  if ((spawned.error as NodeJS.ErrnoException | undefined)?.code === 'ETIMEDOUT') {\n    // Why: spawnSync reports its own deadline through error.code before the\n    // signal field; preserve the typed timeout so cooldown diagnostics work.\n    throw new CodexAppServerTimeoutError(\n      `codex trust-grant entry exceeded ${request.invocation.timeoutMs}ms session deadline`\n    )\n  }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex/codex-app-server-grant-bridge.ts#L72-L108","documentation":"Thrown by runCodexAppServerEntrySync when resolveCodexGrantEntryPath() returns null. That function searches for 'codex-app-server-grant-entry.js' in __dirname and its parent, applying the asar.unpacked path transform. A null return means the entry bundle is not present at either expected location.","triggerScenarios":"Calling runCodexHookTrustGrantSessionSync or runCodexUserHookTrustRebaseSessionSync when the grant entry JS bundle is missing. resolveCodexGrantEntryPath checks two candidate directories and returns null if neither contains the file.","commonSituations":"Packaged build is corrupted or incomplete — the asar.unpacked codex directory is missing. Development build hasn't compiled the grant entry bundle. The __dirname is unexpected (e.g., running from a non-standard location). asarUnpacked configuration in electron-builder is wrong.","solutions":["Check if the file exists: look for out/main/codex/codex-app-server-grant-entry.js (dev) or app.asar.unpacked/out/main/codex/ (packaged).","Rebuild the project to compile the grant entry bundle.","If packaged, verify the electron-builder asarUnpacked config includes 'out/main/codex/**'.","Reinstall Orca if the packaged build is corrupted."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { resolveCodexGrantEntryPath } from '@orca/main/codex/codex-app-server-grant-bridge'\n\nconst entryPath = resolveCodexGrantEntryPath()\nif (!entryPath) {\n  // Do not call runCodexHookTrustGrantSessionSync; show build error\n  showError('Codex trust-grant entry bundle is missing. Reinstall Orca.')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  runCodexHookTrustGrantSessionSync(request)\n} catch (error) {\n  if (error instanceof Error && error.message === 'codex trust-grant entry bundle not found') {\n    // Build/packaging defect; reinstall or rebuild\n  } else { throw error }\n}","preventionTips":["Verify out/main/codex/codex-app-server-grant-entry.js exists after build.","Ensure electron-builder asarUnpacked includes 'out/main/codex/**'.","Run integration tests that exercise the grant entry path in CI."],"tags":["codex","grant-bridge","packaging","asar","missing-bundle"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}