stablyai/orca · error · Error
${response.error.message}
Error message
${response.error.message} What it means
Re-thrown host error from the accounts.consumeCodexResetCredit RPC. The RPC is wrapped with a 90s timeout (RESET_RPC_TIMEOUT_MS) and is idempotent (idempotencyKey + expectedScope), so a failure here is the host refusing or failing the reset — not a client bug. The thrown message is whatever the host put on response.error.message.
Source
Thrown at mobile/src/components/codex-reset-credit.ts:237
async function performCodexResetCreditRequest(
client: Pick<RpcClient, 'sendRequest'>,
options: {
hostId: string
expectedScope: CodexResetCreditExpectedScope
createIdempotencyKey: () => string
}
): Promise<CodexResetCreditRequestResult> {
const attempt = await getOrCreateCodexResetAttempt(options)
const response = await client.sendRequest(
'accounts.consumeCodexResetCredit',
{
idempotencyKey: attempt.idempotencyKey,
expectedScope: attempt.expectedScope
},
{ timeoutMs: RESET_RPC_TIMEOUT_MS }
)
if (!response.ok) {
throw new Error(response.error.message)
}
const result = decodeResetResult(response.result, attempt.expectedScope)
let attemptJournalRetained = false
try {
await clearCodexResetAttemptAfterAuthoritativeResponse({
hostId: options.hostId,
expectedScope: attempt.expectedScope,
idempotencyKey: attempt.idempotencyKey
})
} catch {
attemptJournalRetained = true
}
return { ...result, attemptJournalRetained }
}
export async function requestCodexResetCredit(
client: Pick<RpcClient, 'sendRequest'>,
options: {View on GitHub (pinned to 1136503c6a)
Solutions
- Inspect response.error.code/message before surfacing — 'alreadyRedeemed' style codes are safe to treat as success (the reset was applied), not as a hard failure.
- On timeout-shaped errors, retry with the SAME idempotencyKey (the journal retains it) so the host deduplicates rather than double-consuming a credit.
- On scope-mismatch errors, discard the journal attempt, recompute getCodexResetCreditScope from a fresh snapshot, and start over with a new idempotencyKey.
- If the error is transport-level (disconnected), reconnect the host and retry the idempotent call once.
Example fix
// before
if (!response.ok) {
throw new Error(response.error.message)
}
// after — distinguish recoverable from terminal
if (!response.ok) {
const code = response.error?.code
if (code === 'alreadyRedeemed' || code === 'reset_applied') {
return { outcome: 'alreadyRedeemed', scope: attempt.expectedScope, snapshot: await fetchAccountsSnapshot(client), attemptJournalRetained: false }
}
throw new Error(response.error.message)
} Defensive patterns
Strategy: retry
Validate before calling
// Confirm the host is reachable and the scope is still redeemable
if (connState !== 'connected') throw new Error('Host not connected')
const fresh = getCodexResetCreditScope(await fetchAccountsSnapshot(client))
if (!fresh) throw new Error('No reset credit scope available') Type guard
function isRetryableResetError(err: unknown): boolean {
if (!(err instanceof Error)) return false
const msg = err.message.toLowerCase()
return msg.includes('timeout') || msg.includes('disconnected') || msg.includes('temporarily unavailable')
} Try / catch
try {
return await performCodexResetCreditRequest(client, options)
} catch (err) {
// The idempotencyKey makes retry safe for transient failures
if (isRetryableResetError(err)) {
return await performCodexResetCreditRequest(client, options) // same idempotencyKey
}
throw err
} Prevention
- Always create the idempotencyKey via getOrCreateCodexResetAttempt so retries deduplicate on the host.
- Differentiate 'alreadyRedeemed' style codes from hard failures before surfacing — a redeemed key means success.
- Keep RESET_RPC_TIMEOUT_MS generous (90s) since the host provider call can be slow; do not shrink it for UI responsiveness.
When it happens
Trigger: client.sendRequest('accounts.consumeCodexResetCredit', ...) returns {ok:false}; common server-side reasons: the idempotencyKey was already redeemed with a different scope, the account has no reset credits, the host timed out at 90s, the transport disconnected mid-RPC, or the host rejected expectedScope as stale.
Common situations: Slow or saturated network to the desktop host pushing the consume call past 90s; the desktop's own provider call failing; an old idempotencyKey being replayed after the journal was partially cleared; the user's Codex account has zero credits.
Related errors
- Invalid reset response from host
- Update the paired desktop Orca app to use mobile voice setti
- Failed to load dictation models
- Failed to start download
- Failed to delete model
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/92b853069ec70c5c.
Report an issue: GitHub.