tinyhumansai/openhuman · error · Error

RPC ${method} error: ${JSON.stringify(body.error).slice(0, 3

Error message

RPC ${method} error: ${JSON.stringify(body.error).slice(0, 300)}

What it means

The final guard in rpc() (scripts/debug/agent-prepare-context-audit.mjs): the HTTP response was 2-ok and parsed as JSON, but the JSON-RPC 2.0 envelope contains an error object, which is rethrown as 'RPC <method> error: <first 300 chars of the error object>'. This is a server-side method-level failure — the transport worked and the request reached a handler, which then rejected it.

Source

Thrown at scripts/debug/agent-prepare-context-audit.mjs:283

  } catch (err) {
    if (err?.name === "AbortError")
      throw new Error(`RPC ${method} timed out after ${timeoutMs}ms`);
    throw err;
  } finally {
    clearTimeout(timeout);
  }
  const bodyText = await res.text();
  let body;
  try {
    body = JSON.parse(bodyText);
  } catch {
    throw new Error(
      `RPC ${method} returned non-JSON HTTP ${res.status}: ${bodyText.slice(0, 200)}`,
    );
  }
  if (!res.ok) throw new Error(`RPC ${method} HTTP ${res.status}`);
  if (body.error)
    throw new Error(
      `RPC ${method} error: ${JSON.stringify(body.error).slice(0, 300)}`,
    );
  return body.result;
}

// ── Transcript reading ──────────────────────────────────────────────────────

async function walkJsonl(dir) {
  const out = [];
  async function walk(current) {
    let entries;
    try {
      entries = await readdir(current, { withFileTypes: true });
    } catch {
      return;
    }
    await Promise.all(
      entries.map(async (entry) => {

View on GitHub (pinned to a221052e0d)

Solutions

  1. Read the embedded error message — it is the server's own reason and names the real cause (unknown method vs param error vs domain failure)
  2. Rebuild the core from this branch before auditing (the script header says to run it against a core built from this branch) — cargo build --bin openhuman-core, or use --spawn-core
  3. For auth/session errors, ensure the core is signed into your account (session must be live; LLM calls bill to it)
  4. Check the method exists: GET /schema on the core lists registered controllers and their methods

Example fix

# before
$ node scripts/debug/agent-prepare-context-audit.mjs
Error: RPC openhuman.threads_create_new error: {"code":-32601,"message":"unknown method ..."}

# after (rebuild core from this branch so the controller exists, then)
$ cargo build --bin openhuman-core
$ node scripts/debug/agent-prepare-context-audit.mjs --spawn-core
Defensive patterns

Strategy: try-catch

Validate before calling

// Optional: verify the methods the audit needs are registered
const res = await fetch(`${coreUrl.replace(/\/rpc$/, "")}/schema`);
const schema = await res.json();
for (const needed of ["core.ping", "openhuman.threads_create_new", "openhuman.inference_agent_chat"]) {
  if (!JSON.stringify(schema).includes(needed.split(".").pop())) {
    throw new Error(`${needed} not registered — is this core built from the right branch with the right feature gates?`);
  }
}

Try / catch

try {
  return await rpc(coreUrl, token, method, params);
} catch (e) {
  const m = /RPC (\S+) error: (.*)/s.exec(e.message);
  if (m) {
    const [, failed, detail] = m;
    if (/unknown method|-32601/.test(detail)) throw new Error(`core lacks ${failed} — rebuild from this branch or check feature gates`, { cause: e });
    if (/SESSION_EXPIRED|unauthorized/i.test(detail)) throw new Error(`core session expired for ${failed} — sign in again`, { cause: e });
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling a method the target core does not register: unknown method (e.g. openhuman.threads_create_new after a rename, or a controller compiled out by a Cargo feature gate / DomainSet preset), invalid params (wrong field names/types in the params object), or a domain error raised by the handler itself (e.g. session expired, workspace missing, provider creds absent during inference turns).

Common situations: Running the audit against an older core binary that predates a controller; the script's hardcoded method names (core.ping, openhuman.threads_create_new, openhuman.inference_agent_chat) drifting from the core's current RPC surface; sending chat turns while not signed in, so the backend call inside the turn fails with SESSION_EXPIRED-style errors; feature-gated builds where a namespace is absent at runtime.

Related errors


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