tinyhumansai/openhuman · error · CoreRpcError

Core RPC HTTP

Error message

Core RPC HTTP ${response.status}: ${text || response.statusText}

What it means

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.

Solutions

  1. 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
  2. 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)
  3. Confirm the token source matches the target core (getStoredCoreToken() for remote cores, core_rpc_token for the embedded one)
  4. If behind a proxy, verify POST /rpc is forwarded unmodified with Authorization header intact

Example fix

// before
const result = await callCoreRpc({ method: 'openhuman.composio_list_triggers' });

// after
const result = await callCoreRpc({
  method: 'openhuman.composio_list_triggers',
  suppressAuthExpiredEvent: true, // single 401 here is recoverable, not session death
});
Defensive patterns

Strategy: try-catch

Validate before calling

import { testCoreRpcConnection } from '../services/coreRpcClient';

async function rpcEndpointHealthy(url: string, token?: string): Promise<boolean> {
  const r = await testCoreRpcConnection(url, token);
  return r.ok;
}

Type guard

import { CoreRpcError } from '../services/coreRpcClient';

function isAuthExpired(err: unknown): boolean {
  return err instanceof CoreRpcError && err.kind === 'auth_expired';
}
function hasStatus(err: unknown, status: number): boolean {
  return err instanceof CoreRpcError && err.status === status;
}

Try / catch

try {
  await callCoreRpc({ method, params, suppressAuthExpiredEvent: isNonAuthoritative });
} catch (err) {
  if (isAuthExpired(err)) { /* route to re-auth UI, not a crash */ }
  else if (hasStatus(err, 404)) { /* wrong RPC base URL — config problem, don't retry */ }
  else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/76943037124b6146. Report an issue: GitHub.

Appendix: source

Thrown at app/src/services/coreRpcClient.ts:745

          `Core RPC ${payload.method} timed out after ${effectiveTimeoutMs}ms`,
          'timeout'
        );
      }
      throw fetchErr;
    } finally {
      clearTimeout(timeoutId);
    }

    if (!response.ok) {
      const text = await response.text();
      const httpMessage = `Core RPC HTTP ${response.status}: ${text || response.statusText}`;
      const kind = classifyRpcError(text || response.statusText, response.status);
      if (kind === 'auth_expired' && !suppressAuthExpiredEvent)
        dispatchAuthExpired(
          payload.method,
          classifyAuthExpiredReason(text || response.statusText, response.status)
        );
      throw new CoreRpcError(httpMessage, kind, response.status);
    }

    const json = (await response.json()) as JsonRpcResponse<T>;

    if (json.error) {
      coreRpcError('HTTP error response', {
        id: payload.id,
        method: payload.method,
        error: json.error,
      });
      const rawMessage = json.error.message || 'Core RPC returned an error';
      const kind = classifyRpcError(rawMessage, undefined, json.error.data);
      if (kind === 'auth_expired' && !suppressAuthExpiredEvent)
        dispatchAuthExpired(payload.method, classifyAuthExpiredReason(rawMessage, undefined));
      throw new CoreRpcError(rawMessage, kind, undefined, json.error.data);
    }
    if (!Object.prototype.hasOwnProperty.call(json, 'result')) {
      throw new Error('Core RPC response missing result');

View on GitHub (pinned to 7491200858)