stablyai/orca · warning · Error
A Claude account switch is in progress. Try again after it f
Error message
A Claude account switch is in progress. Try again after it finishes.
What it means
First of four identical-message guards. Thrown at the preflight of one pty spawn controller when isClaudeLaunchCommand(args.command) is true AND the module-level switchInProgress flag in live-pty-gate.ts is true. switchInProgress is set by beginClaudeAuthSwitch and cleared by endClaudeAuthSwitch — it marks a Claude account switch mid-flight during which spawning a new Claude CLI would inherit half-rotated credentials.
Source
Thrown at src/main/ipc/pty.ts:4491
await assertFolderWorkspacePtyPathUsable(args.worktreeId)
}
const cwd = resolvePtySpawnStartupCwd(args.worktreeId, args.cwd)
const provider = getProvider(args.connectionId)
const freshSpawnRecovery = preAdoptedStablePane
? undefined
: recoverFreshSpawnProviderRouting(
provider,
args.connectionId,
args.sessionId,
args.isNewSession
)
if (freshSpawnRecovery) {
await freshSpawnRecovery
}
const isClaudeLaunch =
!preAdoptedStablePane && !args.connectionId && isClaudeLaunchCommand(args.command)
if (isClaudeLaunch && isClaudeAuthSwitchInProgress()) {
throw new Error('A Claude account switch is in progress. Try again after it finishes.')
}
// Why: runtime-created terminals carry no renderer-computed projectRuntime; resolve from worktreeId to honor the project's Windows runtime.
const terminalRuntimeOptions =
process.platform === 'win32' && !args.connectionId
? resolveLocalWindowsTerminalRuntimeOptions({
requestedShellOverride: undefined,
settings: getSettings?.(),
projectRuntime: resolveLocalProjectRuntimeForWorktreeId(store, args.worktreeId),
fallbackHostShell: process.env.COMSPEC || 'powershell.exe'
})
: { shellOverride: undefined, terminalWindowsWslDistro: null }
const daemonShellOverride = terminalRuntimeOptions.shellOverride
const isDaemonHostSpawn =
!args.connectionId &&
!(provider instanceof LocalPtyProvider) &&
!routesFreshSpawnsToLocalProvider(provider)
const callerRequestedSessionId = args.sessionId?.trim()
const requestedSessionId =View on GitHub (pinned to 1136503c6a)
Solutions
- Retry the spawn after the switch completes — the message is literal.
- If the error persists, the switch flag may be stuck: ensure beginClaudeAuthSwitch/endClaudeAuthSwitch are wrapped so endClaudeAuthSwitch always runs (try/finally).
- Gate the UI: disable the 'new Claude terminal' action while isClaudeAuthSwitchInProgress() returns true.
- For a stuck flag, restart the main process to reset the module-level boolean.
Example fix
// before
beginClaudeAuthSwitch()
await doSwitch()
endClaudeAuthSwitch()
// after — guarantee the flag clears even on throw
beginClaudeAuthSwitch()
try {
await doSwitch()
} finally {
endClaudeAuthSwitch()
} Defensive patterns
Strategy: retry
Validate before calling
import { isClaudeAuthSwitchInProgress } from '../claude-accounts/live-pty-gate'
function canSpawnClaudeNow(): boolean {
return !isClaudeAuthSwitchInProgress()
} Type guard
function isClaudeAuthSwitchInProgressError(err: unknown): boolean {
return err instanceof Error && err.message === 'A Claude account switch is in progress. Try again after it finishes.'
} Try / catch
try {
await spawnPty(args)
} catch (err) {
if (isClaudeAuthSwitchInProgressError(err)) {
// surface as 'please retry' — do not count as a hard failure
return { kind: 'retry' }
}
throw err
} Prevention
- In the UI, disable 'new Claude terminal' while isClaudeAuthSwitchInProgress() is true.
- Wrap every beginClaudeAuthSwitch/endClaudeAuthSwitch pair in try/finally so the flag cannot stick.
- Subscribe to a 'switch-finished' signal so the UI re-enables spawn promptly.
When it happens
Trigger: Launching a Claude command (detected by isClaudeLaunchCommand) while a managed Claude account switch is running. isClaudeLaunch requires no preAdoptedStablePane and no connectionId (i.e. a fresh local Claude pane), then checks isClaudeAuthSwitchInProgress().
Common situations: User clicked 'switch Claude account' and immediately opened a new Claude terminal; programmatic switch (settings sync, account picker) racing a workspace-restore spawn; switch that crashed without calling endClaudeAuthSwitch leaving the flag stuck true.
Related errors
- This Claude launch defines explicit Anthropic auth environme
- The Codex account credentials for this session are temporari
- The selected Codex account credentials are temporarily unava
- token is required
- GitHub request failed ${res.status} ${res.statusText}: ${bod
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/8262de4eb7af9177.
Report an issue: GitHub.