stablyai/orca · error · Error

No Codex credentials found in ${resolve(trimmed)}. Run `code

Error message

No Codex credentials found in ${resolve(trimmed)}. Run `codex login` into this directory first.

What it means

Thrown by importCodexAuthFromHome when sourceHome resolves to a real directory but that directory contains no auth.json file. The import flow copies credentials from a pre-authenticated CODEX_HOME, so the source must have already completed `codex login`.

Source

Thrown at src/main/codex-accounts/service.ts:768

      throw error
    }
  }

  // Why: copy the auth.json from an already-authenticated CODEX_HOME (e.g. a temp
  // dir the CLI ran `codex login` into) into the managed home. Mirrors the login
  // step of doAddAccount without spawning an interactive browser flow.
  private importCodexAuthFromHome(
    sourceHome: string,
    managedHomePath: string,
    accountId: string
  ): void {
    const trimmed = sourceHome.trim()
    if (!trimmed) {
      throw new Error('A Codex home directory path is required.')
    }
    const authPath = join(resolve(trimmed), 'auth.json')
    if (!existsSync(authPath)) {
      throw new Error(
        `No Codex credentials found in ${resolve(trimmed)}. Run \`codex login\` into this directory first.`
      )
    }
    const trustedHome = this.assertManagedHomePath(managedHomePath, accountId)
    writeFileAtomically(join(trustedHome, 'auth.json'), readFileSync(authPath, 'utf-8'), {
      mode: 0o600
    })
  }

  private async persistCapturedCodexAccount(
    accountId: string,
    managedHome: ManagedHomeLocation
  ): Promise<CodexRateLimitAccountsState> {
    const identity = this.readIdentityFromHome(managedHome.managedHomePath, accountId)
    if (!identity.email) {
      throw new Error('Codex login completed, but Orca could not resolve the account email.')
    }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Run `codex login` with CODEX_HOME explicitly set to the directory you pass to addAccountFromHome, then retry.
  2. Point addAccountFromHome at the directory that actually contains auth.json (often ~/.codex for a default login).
  3. If you want Orca to drive the browser login itself, use addAccount() instead of the import path.

Example fix

# before: login ran into default HOME, import points elsewhere
CODEX_HOME=/tmp/empty codex login   # creds go to ~/.codex, not /tmp/empty
orca account add --agent codex --from-home /tmp/empty  # throws [909]

# after: log in INTO the directory you import
CODEX_HOME=/tmp/codex-home codex login
orca account add --agent codex --from-home /tmp/codex-home
Defensive patterns

Strategy: validation

Validate before calling

// Confirm auth.json exists in the source home before importing.
import { existsSync } from 'node:fs'
import { resolve } from 'node:path'
const authPath = resolve(sourceHome.trim(), 'auth.json')
if (!existsSync(authPath)) {
  throw new Error(`Run \`codex login\` into ${resolve(sourceHome.trim())} first.`)
}
await service.addAccountFromHome(sourceHome, target)

Try / catch

try {
  await service.addAccountFromHome(sourceHome, target)
} catch (error) {
  if (error instanceof Error && error.message.startsWith('No Codex credentials found')) {
    // instruct: run `CODEX_HOME=<dir> codex login` then retry
  } else throw error
}

Prevention

When it happens

Trigger: addAccountFromHome is called with a path that exists but has no auth.json — i.e. `codex login` was never run into that directory, or was run with a different CODEX_HOME.

Common situations: User points the CLI import at the wrong directory (e.g. the repo root instead of the temp CODEX_HOME), or ran `codex login` with default HOME so credentials landed in ~/.codex instead of the specified dir.

Related errors


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