stablyai/orca · critical · Error
codex trust-grant entry bundle not found
Error message
codex trust-grant entry bundle not found
What it means
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.
Source
Thrown at src/main/codex/codex-app-server-grant-bridge.ts:90
options: RunGrantSessionSyncOptions = {}
): CodexHookTrustGrantSessionResult {
return runCodexAppServerEntrySync(request, options) as CodexHookTrustGrantSessionResult
}
export function runCodexUserHookTrustRebaseSessionSync(
request: CodexUserHookTrustRebaseRequest,
options: RunGrantSessionSyncOptions = {}
): CodexUserHookTrustRebaseResult {
return runCodexAppServerEntrySync(request, options) as CodexUserHookTrustRebaseResult
}
function runCodexAppServerEntrySync(
request: CodexAppServerEntryRequest,
options: RunGrantSessionSyncOptions
): CodexAppServerEntryResult {
const entryPath = options.entryPath ?? resolveCodexGrantEntryPath()
if (!entryPath) {
throw new Error('codex trust-grant entry bundle not found')
}
const spawned = spawnSync(options.nodeCommand ?? process.execPath, [entryPath], {
input: JSON.stringify(request),
encoding: 'utf8',
timeout:
request.invocation.timeoutMs + (options.timeoutMarginMs ?? GRANT_ENTRY_TIMEOUT_MARGIN_MS),
killSignal: 'SIGKILL',
maxBuffer: GRANT_ENTRY_MAX_BUFFER_BYTES,
windowsHide: true,
env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' }
})
if ((spawned.error as NodeJS.ErrnoException | undefined)?.code === 'ETIMEDOUT') {
// Why: spawnSync reports its own deadline through error.code before the
// signal field; preserve the typed timeout so cooldown diagnostics work.
throw new CodexAppServerTimeoutError(
`codex trust-grant entry exceeded ${request.invocation.timeoutMs}ms session deadline`
)
}View on GitHub (pinned to 1136503c6a)
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.
Defensive patterns
Strategy: validation
Validate before calling
import { resolveCodexGrantEntryPath } from '@orca/main/codex/codex-app-server-grant-bridge'
const entryPath = resolveCodexGrantEntryPath()
if (!entryPath) {
// Do not call runCodexHookTrustGrantSessionSync; show build error
showError('Codex trust-grant entry bundle is missing. Reinstall Orca.')
return
} Try / catch
try {
runCodexHookTrustGrantSessionSync(request)
} catch (error) {
if (error instanceof Error && error.message === 'codex trust-grant entry bundle not found') {
// Build/packaging defect; reinstall or rebuild
} else { throw error }
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Packaged main file ${file} was not found in ${asarPath}
- Packaged main bundle has bare runtime imports without copied
- codex trust-grant entry exceeded ${request.invocation.timeou
- codex trust-grant entry killed by ${spawned.signal} after ${
- Missing packaged resources directory: ${resourcesDir}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/7c88049e6ab802d3.
Report an issue: GitHub.