stablyai/orca · warning · CodexResetCreditScopeRejection

accountRuntimeChanged

accountRuntimeChanged

Error message

The selected Codex account belongs to a different runtime.

What it means

A CodexResetCreditScopeRejection with reason 'accountRuntimeChanged'. The account still exists with the same revision, but its selection target (getCodexSelectionTargetForAccount normalized) no longer matches expectedScope.target — i.e. the account itself now belongs to a different runtime/distro than the scope was built for. This catches a mismatch between the runtime the scope targeted and the runtime the account is actually persisted under.

Solutions

  1. Rebuild expectedScope against the account's actual persisted target (getCodexSelectionTargetForAccount).
  2. Verify the account's managedHomeRuntime/wslDistro fields were not corrupted by a migration.
  3. Discard the stale attempt and start fresh once the account/target are consistent.

Example fix

// before: scope targets host but account is now persisted as WSL
service.consumeRateLimitResetCredit(key, scope) // rejects accountRuntimeChanged

// after: derive the scope target from the account itself
const accountTarget = getCodexSelectionTargetForAccount(account)
const scope = buildCodexResetCreditExpectedScope({ target: accountTarget, account, limits })!
await service.consumeRateLimitResetCredit(crypto.randomUUID(), scope)
Defensive patterns

Strategy: validation

Validate before calling

// Derive the target from the account itself rather than assuming it.
const accountTarget = getCodexSelectionTargetForAccount(account)
const scope = buildCodexResetCreditExpectedScope({ target: accountTarget, account, limits })
if (!sameRateLimitTarget(accountTarget, scope!.target)) {
  // account/runtime mismatch — do not consume
}

Try / catch

try {
  await service.consumeRateLimitResetCredit(key, scope)
} catch (error) {
  if (error instanceof CodexResetCreditScopeRejection && error.reason === 'accountRuntimeChanged') {
    // rebuild scope against the account's actual persisted target
  } else throw error
}

Prevention

When it happens

Trigger: validateResetCreditScope recomputes the account's normalized target and compares via sameRateLimitTarget; a divergence (account moved host<->WSL, or distro changed in persisted data) triggers the rejection.

Common situations: Account data was edited/migrated so its persisted managedHomeRuntime/wslDistro no longer matches the rate-limit target that was active when the scope was captured. Rare in normal use; indicates a data migration or manual settings edit.

Related errors


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

Appendix: source

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

        rateLimitState,
        'The selected Codex account changed before reset.'
      )
    }
    const account = settings.codexManagedAccounts.find(
      (candidate) => candidate.id === expectedScope.accountId
    )
    if (!account || account.updatedAt !== expectedScope.accountRevision) {
      throw new CodexResetCreditScopeRejection(
        'accountRevisionChanged',
        rateLimitState,
        'The selected Codex account was updated before reset.'
      )
    }
    const normalizedAccountTarget = normalizeCodexAccountSelectionTarget(
      getCodexSelectionTargetForAccount(account)
    )
    if (!sameRateLimitTarget(normalizedAccountTarget, expectedScope.target)) {
      throw new CodexResetCreditScopeRejection(
        'accountRuntimeChanged',
        rateLimitState,
        'The selected Codex account belongs to a different runtime.'
      )
    }

    const currentScope = buildCodexResetCreditExpectedScope({
      target: rateLimitState.codexTarget,
      account: this.toSummary(account),
      limits: rateLimitState.codex
    })
    // Why: a same-key replay resolves an already-started provider mutation;
    // its credit snapshot may have refreshed, but its account/runtime identity may not change.
    if (requireCurrentOffer && !currentScope) {
      throw new CodexResetCreditScopeRejection(
        'offerUnavailable',
        rateLimitState,
        'The Codex reset-credit offer is no longer available.'

View on GitHub (pinned to 1136503c6a)