tinyhumansai/openhuman · error · Error

${method}: HTTP ${res.status} ${await res.text()}

Error message

${method}: HTTP ${res.status} ${await res.text()}

What it means

The rpc() helper in this manual test driver POSTs a JSON-RPC 2.0 request to the core's /rpc endpoint (RPC_URL, default http://127.0.0.1:7810/rpc) and got a non-2xx HTTP status; it throws with the method name, status, and the raw response body.

Source

Thrown at scripts/test-memory-email-ingest.mjs:53

import { resolve } from "node:path";
import process from "node:process";

const RPC_URL = process.env.RPC_URL || "http://127.0.0.1:7810/rpc";
const OWNER = process.env.OWNER || "stevent95@gmail.com";
const PROVIDER = process.env.PROVIDER || "gmail";
const FIXTURE =
  process.argv[2] ||
  resolve("tests/fixtures/memory/composio_gmail_inbox.json");

let rpcId = 0;
async function rpc(method, params) {
  rpcId += 1;
  const res = await fetch(RPC_URL, {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({ jsonrpc: "2.0", id: rpcId, method, params }),
  });
  if (!res.ok) throw new Error(`${method}: HTTP ${res.status} ${await res.text()}`);
  const body = await res.json();
  if (body.error) {
    throw new Error(`${method}: ${body.error.message || JSON.stringify(body.error)}`);
  }
  return body.result;
}

function parseEmailDate(raw) {
  if (!raw) return Date.now();
  if (typeof raw === "number") return raw < 1e12 ? raw * 1000 : raw;
  const ms = Date.parse(raw);
  return Number.isFinite(ms) ? ms : Date.now();
}

function splitAddresses(value) {
  if (!value) return [];
  if (Array.isArray(value)) return value.filter(Boolean);
  return String(value)

View on GitHub (pinned to a221052e0d)

Solutions

  1. Compare the rpc_url the script prints at startup with the port the core logged
  2. Supply the current token: export OPENAI... no — export OPENHUMAN_CORE_TOKEN from {workspace}/core.token of the running core
  3. Distinguish transport from method problems: curl the /health endpoint on the same base URL
  4. Check the response body included in the error — it names what the server actually objected to

Example fix

# before
node scripts/test-memory-email-ingest.mjs fixture.json   # e.g. 'openhuman.memory_tree_ingest: HTTP 401 ...'

# after
export RPC_URL='http://127.0.0.1:7810/rpc'
export OPENHUMAN_CORE_TOKEN="$(cat ~/.openhuman/users/<id>/workspace/core.token)"
node scripts/test-memory-email-ingest.mjs fixture.json
Defensive patterns

Strategy: validation

Validate before calling

const health = await fetch(new URL('../health', RPC_URL).toString());
if (!health.ok) throw new Error(`core unhealthy (HTTP ${health.status}) — fix transport before RPC`);

Try / catch

try { await rpc(method, params); }
catch (err) {
  if (/^\S+: HTTP \d+/.test(err.message)) { console.error('transport-level failure:', err.message); process.exitCode = 1; }
  else throw err;
}

Prevention

When it happens

Trigger: Transport-level rejection before JSON-RPC semantics apply: 401/403 when the bearer token (OPENHUMAN_CORE_TOKEN for a standalone core) is missing or stale; 404 when RPC_URL points at the wrong path or port; proxy or connection errors surfaced as status codes.

Common situations: Core restarted with a new token while the script kept the old env; RPC_URL pointing at a stale port from a previous run; standalone core started without the token the script assumes.

Related errors


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