stablyai/orca · error · Error

That Codex account belongs to a different runtime.

Error message

That Codex account belongs to a different runtime.

What it means

Thrown by doSelectAccount when selecting a specific account (accountId !== null). The requested target's runtime (host vs wsl) — and, for WSL, the distro if one was explicitly requested — does not match the account's persisted selection target. An account can only be selected for the runtime it belongs to; cross-runtime selection is refused.

Source

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

    return this.getSnapshot()
  }

  private async doSelectAccount(
    accountId: string | null,
    target?: CodexAccountSelectionTarget
  ): Promise<CodexRateLimitAccountsState> {
    let effectiveTarget = target
    if (accountId !== null) {
      const account = this.requireAccount(accountId)
      const accountTarget = getCodexSelectionTargetForAccount(account)
      const requestedTarget = normalizeCodexAccountSelectionTarget(target ?? accountTarget)
      const normalizedAccountTarget = normalizeCodexAccountSelectionTarget(accountTarget)
      if (
        requestedTarget.runtime !== normalizedAccountTarget.runtime ||
        (requestedTarget.wslDistro !== null &&
          requestedTarget.wslDistro !== normalizedAccountTarget.wslDistro)
      ) {
        throw new Error('That Codex account belongs to a different runtime.')
      }
      effectiveTarget = accountTarget
    }

    const previousSettings = this.store.getSettings()
    const selection = normalizeCodexRuntimeSelection(previousSettings)
    const outgoingAccountId = getSelectedCodexAccountIdForTarget(previousSettings, effectiveTarget)
    const nextSelection = setSelectedCodexAccountIdForTarget(selection, accountId, effectiveTarget)

    this.store.updateSettings({
      activeCodexManagedAccountId:
        effectiveTarget?.runtime === 'wsl' ? nextSelection.host : accountId,
      activeCodexManagedAccountIdsByRuntime: nextSelection
    })
    this.safeSyncCanonicalConfigToManagedHomes()
    this.runtimeHome.syncForCurrentSelection(effectiveTarget)
    if (
      accountId === null &&

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Derive the target from the account itself via getCodexSelectionTargetForAccount and pass that (or omit target) when selecting.
  2. Fix the UI so each account is only selectable within its own runtime/distro scope.
  3. If you genuinely need the account in another runtime, remove and re-add it under that runtime via addAccount(target).

Example fix

// before: forcing a host account into a WSL target
service.selectAccountForTarget(hostAccountId, { runtime: 'wsl', wslDistro: 'Ubuntu' }) // throws [912]

// after: select using the account's own target
const accountTarget = getCodexSelectionTargetForAccount(account)
await service.selectAccountForTarget(account.id, accountTarget)
Defensive patterns

Strategy: type-guard

Validate before calling

// Only select the account under its own runtime target.
const accountTarget = getCodexSelectionTargetForAccount(account)
const requested = normalizeCodexAccountSelectionTarget(target ?? accountTarget)
if (requested.runtime !== accountTarget.runtime ||
    (requested.wslDistro && requested.wslDistro !== accountTarget.wslDistro)) {
  throw new Error('Account belongs to a different runtime.')
}
await service.selectAccountForTarget(account.id, accountTarget)

Type guard

const belongsToTarget = (account: CodexManagedAccount, target: CodexAccountSelectionTarget): boolean => {
  const t = normalizeCodexAccountSelectionTarget(getCodexSelectionTargetForAccount(account))
  const r = normalizeCodexAccountSelectionTarget(target)
  return t.runtime === r.runtime && (r.wslDistro === null || t.wslDistro === r.wslDistro)
}

Try / catch

try {
  await service.selectAccountForTarget(accountId, target)
} catch (error) {
  if (error instanceof Error && error.message === 'That Codex account belongs to a different runtime.') {
    // derive the target from the account and retry
  } else throw error
}

Prevention

When it happens

Trigger: Calling selectAccountForTarget(accountId, target) where target.runtime or target.wslDistro conflicts with getCodexSelectionTargetForAccount(account). Also selectAccount(accountId) on the default target when the account lives in a different runtime.

Common situations: UI offers an account under the wrong runtime tab (e.g. a host-runtime account shown in the WSL distro selector), or a caller hardcodes a target without checking which runtime the account was created under.

Related errors


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