tinyhumansai/openhuman · error

[transport:local] HTTP ${response.status}: ${text || respons

Error message

[transport:local] HTTP ${response.status}: ${text || response.statusText}

What it means

Thrown by LocalTransport.request when the embedded core's HTTP RPC endpoint answers with a non-2xx status. The message embeds the HTTP status plus the response body (or statusText when the body is empty), so the real cause is whatever the core's /rpc endpoint reported. Most often it is 401 from a stale per-launch bearer token or 5xx from a core-side handler failure.

Source

Thrown at app/src/services/transport/LocalTransport.ts:77

    try {
      response = await fetch(rpcUrl, {
        method: 'POST',
        headers,
        body: JSON.stringify(payload),
        signal: controller.signal,
      });
    } catch (err) {
      if (controller.signal.aborted) {
        throw new Error(`[transport:local] ${method} timed out after ${this.timeoutMs}ms`);
      }
      throw err;
    } finally {
      clearTimeout(timeoutId);
    }

    if (!response.ok) {
      const text = await response.text();
      throw new Error(`[transport:local] HTTP ${response.status}: ${text || response.statusText}`);
    }

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

    if (json.error) {
      logErr('[transport:local] ← %s error: %s', method, json.error.message);
      throw new Error(json.error.message ?? 'Core RPC returned an error');
    }
    if (!Object.prototype.hasOwnProperty.call(json, 'result')) {
      throw new Error('[transport:local] response missing result');
    }

    log('[transport:local] ← %s id=%d ok', method, id);
    return json.result as T;
  }

  async *stream<T>(
    method: string,

View on GitHub (pinned to a221052e0d)

Solutions

  1. Parse the embedded status: 401 means stale token/URL — re-fetch via the Tauri commands core_rpc_url and core_rpc_token, rebuild the transport, retry once
  2. Verify the core process is alive (restart_core_process / daemonHealthService) and retry after it reports healthy
  3. For external-core debugging, confirm OPENHUMAN_CORE_TOKEN matches the token written to {workspace}/core.token
  4. For 5xx, read the core file log for the handler panic and fix the domain-side error

Example fix

// before
const result = await transport.call('openhuman.ping', {});

// after
try {
  const result = await transport.call('openhuman.ping', {});
} catch (err) {
  const m = /\[transport:local\] HTTP (\d+): (.*)/.exec(String(err.message));
  if (m && m[1] === '401') {
    await rebuildTransportFromShell(); // re-fetch URL + bearer, retry once
  } else {
    throw err;
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

async function coreRpcReady(rpcUrl: string, token: string): Promise<boolean> {
  try {
    const res = await fetch(rpcUrl, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
      body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'openhuman.ping', params: {} }),
    });
    return res.ok;
  } catch {
    return false;
  }
}

Try / catch

Catch, then parse the `HTTP <status>` prefix from err.message: on 401 rebuild the transport from freshly fetched core_rpc_url/core_rpc_token and retry once; on 5xx surface the embedded body text as the core error; otherwise rethrow.

Prevention

When it happens

Trigger: Any transport.call() (i.e. every coreRpcClient request via relay_http_rpc) when fetch resolves with response.ok === false: POST to http://127.0.0.1:<port>/rpc returning 401 (stale hex bearer / mismatched OPENHUMAN_CORE_TOKEN), 404 (port from a previous core launch), 400 (malformed JSON-RPC body), or 500 (core handler error).

Common situations: Core restarted and got a new ephemeral port+token while the renderer cached the old pair; OPENHUMAN_CORE_REUSE_EXISTING=1 pointing at an external core whose token differs from {workspace}/core.token; core process crashed mid-request; a loopback-intercepting proxy or antivirus rewriting the response.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/267368510e7a34c0. Report an issue: GitHub.