{"record":{"id":"aaf615af9787c961","repo":"chatboxai/chatbox","slug":"status-code-retryres-status-sanitizeresponse","errorCode":null,"errorMessage":"Status Code ${retryRes.status}, ${sanitizeResponseBody(retryRes.status, response)}","messagePattern":"Status Code (.+?), (.+?)","errorType":"http","errorClass":"ApiError","httpStatus":null,"severity":"error","filePath":"src/shared/request/request.ts","lineNumber":304,"sourceCode":"          }\n\n          console.debug('🔄 Retrying request with new token...')\n          const retryRes = await fetch(url, init)\n\n          if (!retryRes.ok) {\n            const response = await retryRes.text().catch((e: unknown) => {\n              console.error('[authenticatedAfetch] Failed to read retry error response body:', e)\n              return ''\n            })\n            const requestId = getChatboxRequestId(response, retryRes.headers)\n            if (options.parseChatboxRemoteError) {\n              const backendErrorCode = getChatboxErrorCode(response)\n              const chatboxAIError = ChatboxAIAPIError.fromCodeName(response, backendErrorCode || '', requestId)\n              if (chatboxAIError) {\n                throw chatboxAIError\n              }\n            }\n            throw new ApiError(\n              `Status Code ${retryRes.status}, ${sanitizeResponseBody(retryRes.status, response)}`,\n              response || undefined,\n              retryRes.status,\n              requestId\n            )\n          }\n\n          return retryRes\n        }\n\n        // 其他错误状态码\n        if (!res.ok) {\n          const response = await res.text().catch((e: unknown) => {\n            console.error('[authenticatedAfetch] Failed to read error response body:', e)\n            return ''\n          })\n          const requestId = getChatboxRequestId(response, res.headers)\n          if (options.parseChatboxRemoteError) {","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/shared/request/request.ts#L286-L322","documentation":"Error \"Status Code ${retryRes.status}, ${sanitizeResponseBody(retryRes.status, response)}\" thrown in chatboxai/chatbox.","triggerScenarios":"Thrown at src/shared/request/request.ts:304 when the library encounters an invalid state.","commonSituations":"Occurs in src/shared/request/request.ts when the retried request after a token refresh still returns a non-success HTTP status.","solutions":["The request still failed after a token refresh; read the sanitized body in the error for the upstream reason.","If status is still 401 after refresh, the account/session is invalid — log in again.","For 429/5xx after refresh, back off and retry later."],"exampleFix":"if (!retryRes.ok) {\n  const response = await retryRes.text()\n  // Fresh token did not help; inspect status and body, then re-login or retry\n}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}