tinyhumansai/openhuman · error · Error
spawned core exited with ${child.exitCode} ${stderrFn()}
Error message
spawned core exited with ${child.exitCode}
${stderrFn()} What it means
waitForCore() polls core.ping every 750 ms for up to 180 s while a freshly spawned `cargo run --bin openhuman-core -- run --jsonrpc-only` child boots. If the child process exits before ever answering a ping, this error reports the exit code plus the last 8 KB of captured stderr. It means the core failed during startup, not that it was slow.
Source
Thrown at scripts/debug/goals-live.mjs:393
stdio: opts.verbose ? ["ignore", "inherit", "inherit"] : ["ignore", "ignore", "pipe"],
},
);
let stderr = "";
if (child.stderr) {
child.stderr.on("data", (c) => {
stderr += c.toString();
if (stderr.length > 8000) stderr = stderr.slice(-8000);
});
}
await waitForCore(opts.coreUrl, token, child, () => stderr);
return { child, token };
}
async function waitForCore(coreUrl, token, child, stderrFn) {
const deadline = Date.now() + 180_000;
while (Date.now() < deadline) {
if (child.exitCode !== null)
throw new Error(`spawned core exited with ${child.exitCode}\n${stderrFn()}`);
try {
await rpc(coreUrl, token, "core.ping", {}, 10_000);
return;
} catch {
await new Promise((r) => setTimeout(r, 750));
}
}
throw new Error(`timed out waiting for core at ${coreUrl}\n${stderrFn()}`);
}
async function stopChild(child) {
if (child.exitCode !== null || child.signalCode !== null) return;
child.kill("SIGTERM");
const exited = await Promise.race([
once(child, "exit").then(() => true),
new Promise((r) => setTimeout(() => r(false), 5000)),
]);
if (exited) return;View on GitHub (pinned to a221052e0d)
Solutions
- Read the stderr tail in the message — it is the actual compiler/runtime failure
- If stderr shows 'address already in use', drop --core-url / unset OPENHUMAN_CORE_RPC_URL so the script picks a free port, or stop the existing core
- Prebuild to surface compile errors separately: `cargo build --bin openhuman-core`, fix, then rerun
- Rerun with --verbose to stream the child's stdout/stderr live instead of the tail
Example fix
# before: explicit URL collides with a running core OPENHUMAN_CORE_RPC_URL=http://127.0.0.1:7788/rpc node scripts/debug/goals-live.mjs --spawn-core # Error: spawned core exited with 1 ... address already in use # after: let the script pick a free port node scripts/debug/goals-live.mjs --spawn-core
Defensive patterns
Strategy: validation
Validate before calling
// before spawning: ensure the port from the URL is free, or drop the explicit URL
import { createConnection } from "node:net";
const port = Number(new URL(coreUrl).port || 7788);
const busy = await new Promise((r) => {
const s = createConnection({ port, host: "127.0.0.1" });
s.on("connect", () => { s.destroy(); r(true); });
s.on("error", () => r(false));
});
if (busy && opts.coreUrlExplicit) {
console.error(`port ${port} occupied — unset OPENHUMAN_CORE_RPC_URL or stop the running core`);
process.exit(2);
} Try / catch
try {
await waitForCore(coreUrl, token, child, stderrFn);
} catch (err) {
if (/spawned core exited/.test(err.message)) {
// run `cargo build --bin openhuman-core` once to surface the compile error directly
throw new Error(`core failed to start; build it separately to see the error\n${err.message}`);
}
throw err;
} Prevention
- Do not export OPENHUMAN_CORE_RPC_URL globally — it silently forces --spawn-core onto a fixed port
- Compile first (`cargo build --bin openhuman-core`) so spawn failures are runtime, not compiler, errors
- Use --verbose whenever a spawned core dies so the failure is streamed, not a tail
When it happens
Trigger: Rust compile error or panic at core startup (exit 101 with compiler/panic output in stderr); port already in use when --core-url was passed explicitly (or OPENHUMAN_CORE_RPC_URL set), because startCore only auto-picks a free port when the URL was NOT explicit; env vars like OPENHUMAN_WORKSPACE pointing somewhere unwritable; cargo not finding the manifest (wrong cwd, though the script resolves repo root).
Common situations: Developer has a core already listening on 7788 and exports OPENHUMAN_CORE_RPC_URL=http://127.0.0.1:7788/rpc, so the spawned child cannot bind and exits; a mid-rebase tree that does not compile; stale target/ artifacts confusing the build; workspace permissions in a read-only mount.
Related errors
- spawned core exited with ${child.exitCode}\n${stderrFn()}
- timed out waiting for core at ${coreUrl} ${stderrFn()}
- timed out waiting for spawned core at ${coreUrl}\n${stderrFn
- Invalid ${paramName}: '${value}'. Must be a valid integer ID
- spawned core exited with ${child.exitCode} ${stderrFn()}
AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16).
Data as JSON: /api/errors/1b00dfb8b817795b.
Report an issue: GitHub.