stablyai/orca · error · CodexAppServerTimeoutError

codex trust-grant entry exceeded ${request.invocation.timeou

Error message

codex trust-grant entry exceeded ${request.invocation.timeoutMs}ms session deadline

What it means

Thrown as CodexAppServerTimeoutError when spawnSync reports error.code === 'ETIMEDOUT'. The spawn timeout is request.invocation.timeoutMs plus a margin (GRANT_ENTRY_TIMEOUT_MARGIN_MS, 5s). The typed error preserves the session deadline for cooldown diagnostics. This means the grant entry child process did not complete within the allotted time.

Source

Thrown at src/main/codex/codex-app-server-grant-bridge.ts:105

): 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`
    )
  }
  if (spawned.error) {
    throw spawned.error
  }
  if (spawned.signal) {
    throw new CodexAppServerTimeoutError(
      `codex trust-grant entry killed by ${spawned.signal} after ${request.invocation.timeoutMs}ms deadline`
    )
  }
  const lines = (spawned.stdout ?? '').split('\n').filter((line) => line.trim().length > 0)
  const lastLine = lines.at(-1)
  let envelope: GrantEntryEnvelope | null = null
  if (lastLine) {
    try {
      envelope = JSON.parse(lastLine) as GrantEntryEnvelope
    } catch {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Retry the trust-grant operation — transient hangs may resolve.
  2. Check network connectivity to the codex/OAuth endpoints.
  3. If the issue persists, increase request.invocation.timeoutMs if the caller controls it.
  4. Check if codex CLI itself is functional: run the codex command manually outside Orca.
Defensive patterns

Strategy: retry

Type guard

import { CodexAppServerTimeoutError } from '@orca/main/codex/codex-app-server-client'

function isGrantTimeout(error: unknown): error is CodexAppServerTimeoutError {
  return error instanceof CodexAppServerTimeoutError
}

Try / catch

try {
  runCodexHookTrustGrantSessionSync(request)
} catch (error) {
  if (error instanceof CodexAppServerTimeoutError &&
      error.message.includes('exceeded') &&
      error.message.includes('session deadline')) {
    // Retry with backoff; cooldown diagnostics available on the typed error
  } else { throw error }
}

Prevention

When it happens

Trigger: The ELECTRON_RUN_AS_NODE child process running the codex trust-grant session exceeded the spawnSync timeout. The codex app-server inside the entry hung, the network was slow during OAuth, or the session JSON-RPC stream stalled.

Common situations: Codex app-server is unresponsive or waiting on a network request that never completes. The OAuth flow inside the grant entry is waiting for user interaction that doesn't come. System under heavy load causing the child to be starved. DNS resolution hanging.

Understand the failure class

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/fb9e7516962e6f78. Report an issue: GitHub.