{"record":{"id":"76943037124b6146","repo":"tinyhumansai/openhuman","slug":"core-rpc-http-response-status-text-respon","errorCode":null,"errorMessage":"Core RPC HTTP ${response.status}: ${text || response.statusText}","messagePattern":"Core RPC HTTP (.+?): (.+?)","errorType":"http","errorClass":"CoreRpcError","httpStatus":null,"severity":"error","filePath":"app/src/services/coreRpcClient.ts","lineNumber":745,"sourceCode":"          `Core RPC ${payload.method} timed out after ${effectiveTimeoutMs}ms`,\n          'timeout'\n        );\n      }\n      throw fetchErr;\n    } finally {\n      clearTimeout(timeoutId);\n    }\n\n    if (!response.ok) {\n      const text = await response.text();\n      const httpMessage = `Core RPC HTTP ${response.status}: ${text || response.statusText}`;\n      const kind = classifyRpcError(text || response.statusText, response.status);\n      if (kind === 'auth_expired' && !suppressAuthExpiredEvent)\n        dispatchAuthExpired(\n          payload.method,\n          classifyAuthExpiredReason(text || response.statusText, response.status)\n        );\n      throw new CoreRpcError(httpMessage, kind, response.status);\n    }\n\n    const json = (await response.json()) as JsonRpcResponse<T>;\n\n    if (json.error) {\n      coreRpcError('HTTP error response', {\n        id: payload.id,\n        method: payload.method,\n        error: json.error,\n      });\n      const rawMessage = json.error.message || 'Core RPC returned an error';\n      const kind = classifyRpcError(rawMessage, undefined, json.error.data);\n      if (kind === 'auth_expired' && !suppressAuthExpiredEvent)\n        dispatchAuthExpired(payload.method, classifyAuthExpiredReason(rawMessage, undefined));\n      throw new CoreRpcError(rawMessage, kind, undefined, json.error.data);\n    }\n    if (!Object.prototype.hasOwnProperty.call(json, 'result')) {\n      throw new Error('Core RPC response missing result');","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/services/coreRpcClient.ts#L727-L763","documentation":"The POST to the core's /rpc endpoint returned a non-2xx HTTP status; the body text (or statusText when empty) is embedded and classifyRpcError maps it to a kind (e.g. auth_expired for 401s). When the kind is auth_expired and suppressAuthExpiredEvent is false, dispatchAuthExpired fires the global event that clears the session and unmounts the current screen. The thrown CoreRpcError carries response.status.","triggerScenarios":"401 from a stale/incorrect bearer (cloud-mode token pointing at local core, or vice versa); 404 from a wrong RPC base URL (proxy path typo, remote core without the route); 500 from a core-side handler panic; gateway/proxy errors (502/503) between renderer and core.","commonSituations":"Cloud-mode stored token left over from a remote profile while running embedded; OPENHUMAN_CORE_TOKEN mismatch between shell and core; reverse proxy or CORS-layer interception rewriting the URL; core version older than the frontend method routing assumptions.","solutions":["Read err.status: 401 → token mismatch (clear/re-resolve the core token, re-auth); 404 → fix the RPC base URL; 5xx → inspect core logs for the failing handler","For non-authoritative reads, pass suppressAuthExpiredEvent: true so a single 401 does not kill the whole session, then offer an in-place re-auth CTA (#4281 pattern)","Confirm the token source matches the target core (getStoredCoreToken() for remote cores, core_rpc_token for the embedded one)","If behind a proxy, verify POST /rpc is forwarded unmodified with Authorization header intact"],"exampleFix":"// before\nconst result = await callCoreRpc({ method: 'openhuman.composio_list_triggers' });\n\n// after\nconst result = await callCoreRpc({\n  method: 'openhuman.composio_list_triggers',\n  suppressAuthExpiredEvent: true, // single 401 here is recoverable, not session death\n});","handlingStrategy":"try-catch","validationCode":"import { testCoreRpcConnection } from '../services/coreRpcClient';\n\nasync function rpcEndpointHealthy(url: string, token?: string): Promise<boolean> {\n  const r = await testCoreRpcConnection(url, token);\n  return r.ok;\n}","typeGuard":"import { CoreRpcError } from '../services/coreRpcClient';\n\nfunction isAuthExpired(err: unknown): boolean {\n  return err instanceof CoreRpcError && err.kind === 'auth_expired';\n}\nfunction hasStatus(err: unknown, status: number): boolean {\n  return err instanceof CoreRpcError && err.status === status;\n}","tryCatchPattern":"try {\n  await callCoreRpc({ method, params, suppressAuthExpiredEvent: isNonAuthoritative });\n} catch (err) {\n  if (isAuthExpired(err)) { /* route to re-auth UI, not a crash */ }\n  else if (hasStatus(err, 404)) { /* wrong RPC base URL — config problem, don't retry */ }\n  else throw err;\n}","preventionTips":["Use suppressAuthExpiredEvent for non-authoritative reads so one 401 cannot sign the user out (#4281 pattern)","Validate the RPC URL + token pair with testCoreRpcConnection before persisting a profile","Keep the token source matched to the target core (stored cloud token vs local sidecar token)"],"tags":["rpc","http-status","auth-expired","classification","proxy"],"backgroundTag":"http-error-response","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}