{"record":{"id":"53d7e370729ea23c","repo":"tinyhumansai/openhuman","slug":"rpc-method-error-body-error-message-json","errorCode":null,"errorMessage":"RPC ${method} error: ${body.error.message || JSON.stringify(body.error)}","messagePattern":"RPC (.+?) error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/goals-live.mjs","lineNumber":210,"sourceCode":"      }),\n    });\n  } catch (err) {\n    if (err?.name === \"AbortError\")\n      throw new Error(`RPC ${method} timed out after ${timeoutMs}ms`);\n    throw err;\n  } finally {\n    clearTimeout(timer);\n  }\n  const text = await res.text();\n  let body;\n  try {\n    body = JSON.parse(text);\n  } catch {\n    throw new Error(`RPC ${method} returned non-JSON HTTP ${res.status}: ${text.slice(0, 200)}`);\n  }\n  if (!res.ok) throw new Error(`RPC ${method} HTTP ${res.status}`);\n  if (body.error)\n    throw new Error(`RPC ${method} error: ${body.error.message || JSON.stringify(body.error)}`);\n  return body.result;\n}\n\n// RpcOutcome serializes either as the bare value (no logs) or { result, logs }.\nfunction unwrap(result) {\n  if (result && typeof result === \"object\" && \"result\" in result && \"logs\" in result) {\n    return { value: result.result, logs: result.logs || [] };\n  }\n  return { value: result, logs: [] };\n}\n\nfunction renderGoals(doc) {\n  const items = doc?.items || [];\n  if (items.length === 0) return \"    (no goals)\";\n  return items.map((g) => `    - [${g.id}] ${g.text}`).join(\"\\n\");\n}\n\n// ── transcript auditing ─────────────────────────────────────────────────────","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/goals-live.mjs#L192-L228","documentation":"This is the JSON-RPC application-level failure: HTTP was 200 and the body parsed, but it contains an `error` object, which rpc() re-throws with the server's message. In goals-live.mjs these calls are openhuman.memory_goals_list / _add / _edit / _delete / _reflect and core.ping, so the message text comes from the core's controller dispatch — unknown method, invalid params, missing agent definition, or an unconfigured inference provider.","triggerScenarios":"`unknown method` when the running core binary predates the memory_goals RPC namespace (stale ./target/debug/openhuman-core); invalid params for memory_goals_edit (bad id); memory_goals_reflect failing because no provider/model is configured or the goals_agent builtin definition is missing in that workspace; persistence/store errors from a corrupted goals DB.","commonSituations":"Binary drift: core last built weeks ago, script expects current namespaces; running against a slim/feature-gated build where the goals domain is compiled out (unknown-method per the DomainSet/feature gates); isolated temp workspace lacking the goals_agent definition; provider credentials absent so enrichment cannot run.","solutions":["Read the server message in the error — it names the exact RPC fault (unknown method vs param vs provider)","Rebuild and restart the core: `cargo build --manifest-path Cargo.toml --bin openhuman-core` then rerun, or use --spawn-core which cargo-runs the current source","Verify the method exists on the live core: `curl -s <core>/schema | jq '.[] | select(.namespace==\"memory_goals\")'`","For reflect failures, configure a default model/provider in the core config or pass --model","For param errors, check the id/text values the script derives from the prior goals_list call"],"exampleFix":"# before: core binary predates the goals namespace\nnode scripts/debug/goals-live.mjs\n# Error: RPC openhuman.memory_goals_list error: unknown method: openhuman.memory_goals_list\n\n# after: spawn a core built from current source\nnode scripts/debug/goals-live.mjs --spawn-core","handlingStrategy":"try-catch","validationCode":"// confirm the methods the run needs exist on the live core before starting\nconst schema = await (await fetch(coreUrl.replace(\"/rpc\", \"/schema\"), {\n  headers: { authorization: `Bearer ${token}` },\n})).json();\nconst methods = new Set(collectMethodNames(schema)); // walk ControllerSchema entries\nfor (const m of [\"openhuman.memory_goals_list\", \"openhuman.memory_goals_reflect\"]) {\n  if (!methods.has(m)) { console.error(`${m} missing on this core — rebuild/restart`); process.exit(2); }\n}","typeGuard":"const isJsonRpcErrorBody = (body) =>\n  !!body && typeof body === \"object\" && \"error\" in body && body.error != null;","tryCatchPattern":"try {\n  result = await rpc(coreUrl, token, method, params);\n} catch (err) {\n  if (/error: unknown method/.test(err.message)) {\n    throw new Error(`${method} missing — the core binary is stale; rebuild with cargo build --bin openhuman-core`);\n  }\n  if (/provider|model/i.test(err.message)) {\n    // enrich/reflect needs a configured provider — guide instead of failing opaque\n    throw new Error(`${err.message} (configure a default model or pass --model)`);\n  }\n  throw err;\n}","preventionTips":["Rebuild the core after pulling changes that touch RPC namespaces before running live audits","Check GET /schema when a method error appears — it is the authoritative live surface","Keep --model pointed at a model the core actually routes; reflect fails without a provider"],"tags":["rpc","jsonrpc","version-drift","llm-inference"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}