paperclipai/paperclip · error · CodexQuotaAuthError
chatgpt wham api returned
Error message
chatgpt wham api returned ${resp.status} What it means
Error "chatgpt wham api returned ${resp.status}" thrown in paperclipai/paperclip.
Solutions
- Retry later; the quota API returned an error status.
- Re-authenticate Codex if the status indicates auth failure.
When it happens
Trigger: Thrown at packages/adapters/codex-local/src/server/quota.ts:295 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/56f2b013f739da59.
Report an issue: GitHub.
Appendix: source
Thrown at packages/adapters/codex-local/src/server/quota.ts:295
}
export async function fetchCodexQuota(
token: string,
accountId: string | null,
): Promise<QuotaWindow[]> {
const headers: Record<string, string> = {
Authorization: `Bearer ${token}`,
};
if (accountId) headers["ChatGPT-Account-Id"] = accountId;
const resp = await fetchWithTimeout("https://chatgpt.com/backend-api/wham/usage", { headers });
if (!resp.ok) {
const message = `chatgpt wham api returned ${resp.status}`;
const responseText = await readResponseTextPrefix(resp);
const authFailure = classifyCodexAuthRefreshFailure({
errorMessage: [message, responseText].filter(Boolean).join("\n"),
});
if (authFailure) throw new CodexQuotaAuthError(message, authFailure);
throw new Error(message);
}
const body = (await resp.json()) as WhamUsageResponse;
const windows: QuotaWindow[] = [];
const rateLimit = body.rate_limit;
if (rateLimit?.primary_window != null) {
const w = rateLimit.primary_window;
windows.push({
label: "5h limit",
usedPercent: normalizeCodexUsedPercent(w.used_percent),
resetsAt:
typeof w.reset_at === "number"
? unixSecondsToIso(w.reset_at)
: (w.reset_at ?? null),
valueLabel: null,
detail: null,
});View on GitHub (pinned to 120ae5428f)