{"record":{"id":"32b07ce8902062f5","repo":"tinyhumansai/openhuman","slug":"transport-cloud-http-response-status-text","errorCode":null,"errorMessage":"[transport:cloud] HTTP ${response.status}: ${text || response.statusText}","messagePattern":"\\[transport:cloud\\] HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/services/transport/CloudHttpTransport.ts","lineNumber":75,"sourceCode":"    try {\n      response = await fetch(this.rpcUrl, {\n        method: 'POST',\n        headers,\n        body: JSON.stringify(payload),\n        signal: controller.signal,\n      });\n    } catch (err) {\n      if (controller.signal.aborted) {\n        throw new Error(`[transport:cloud] ${method} timed out after ${this.timeoutMs}ms`);\n      }\n      throw err;\n    } finally {\n      clearTimeout(timeoutId);\n    }\n\n    if (!response.ok) {\n      const text = await response.text();\n      throw new Error(`[transport:cloud] HTTP ${response.status}: ${text || response.statusText}`);\n    }\n\n    const json = (await response.json()) as JsonRpcResponse<T>;\n\n    if (json.error) {\n      logErr('[transport:cloud] ← %s error: %s', method, json.error.message);\n      throw new Error(json.error.message ?? 'Cloud RPC returned an error');\n    }\n    if (!Object.prototype.hasOwnProperty.call(json, 'result')) {\n      throw new Error('[transport:cloud] response missing result');\n    }\n\n    log('[transport:cloud] ← %s id=%d ok', method, id);\n    return json.result as T;\n  }\n\n  async *stream<T>(\n    method: string,","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/services/transport/CloudHttpTransport.ts#L57-L93","documentation":"The cloud transport's POST to the configured rpcUrl returned a non-2xx status; the response body text (or statusText when empty) is inlined with the status code. Unlike the local coreRpcClient, this path does NO error classification — no auth_expired detection, no session event — it is a plain Error, so 401s from the cloud core will not auto-sign the user out.","triggerScenarios":"401/403 from an expired or wrong bearerToken in the connection profile; 404 from a mis-typed cloud RPC URL; 502/503 from the cloud provider; TLS-terminating proxies rejecting the request.","commonSituations":"Connection profile saved with an old token after cloud re-auth; URL pointing at a REST base instead of the /rpc path; provider outage; firewall rewriting host headers.","solutions":["Read the status from the message prefix: 401/403 → refresh the profile's bearer token; 404 → fix the rpcUrl to include the RPC path; 5xx → provider-side, retry with backoff","Use testCoreRpcConnection(url, token) to validate a freshly entered URL/token before saving the profile","Re-save the connection profile after cloud re-authentication so the token is current"],"exampleFix":"// before\nconst resp = await transport.call('core.ping', {});\n\n// after\nconst probe = await testCoreRpcConnection(url, candidateToken);\nif (!probe.ok) throw new Error(`profile invalid: HTTP ${probe.status}`);\nsetActiveCoreTransport(new CloudHttpTransport(url, candidateToken));","handlingStrategy":"validation","validationCode":"import { testCoreRpcConnection } from '../../coreRpcClient';\n\nasync function profileReachable(url: string, token?: string): Promise<boolean> {\n  try { return (await testCoreRpcConnection(url, token)).ok; } catch { return false; }\n}","typeGuard":"function isCloudHttpError(err: unknown): err is Error & { message: string } {\n  return err instanceof Error && /^\\[transport:cloud\\] HTTP \\d{3}/.test(err.message);\n}\nfunction httpStatusOf(err: unknown): number | null {\n  const m = err instanceof Error ? err.message.match(/HTTP (\\d{3})/) : null;\n  return m ? Number(m[1]) : null;\n}","tryCatchPattern":"try {\n  return await transport.call(method, params);\n} catch (err) {\n  const status = httpStatusOf(err);\n  if (status === 401 || status === 403) { await refreshProfileToken(); return transport.call(method, params); }\n  if (status === 404) throw new ConfigError('cloud RPC URL missing /rpc path');\n  throw err;\n}","preventionTips":["Validate URL+token with testCoreRpcConnection before installing the transport","This path never auto-expires sessions — implement your own 401 handling for cloud profiles","Re-save the connection profile after cloud re-auth"],"tags":["transport","cloud","http-status","auth","connection-profile"],"backgroundTag":"http-error-response","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}