JuliusBrussee/caveman · error
caveman agent: Cave Runtime failed to start
Error message
caveman agent: Cave Runtime failed to start (${error instanceof Error ? error.message : String(error)}) What it means
When the agent runtime spawns the Cave Runtime daemon ('caveman start'), failures to even construct the portable invocation (e.g. the CLI binary cannot be resolved for the platform) are wrapped into this error. It reports the underlying message so the caller knows the runtime process never launched.
Solutions
- Install the Caveman CLI so 'caveman' resolves on PATH (caveman setup --install)
- Check/fix the CAVEMAN_CLI_BIN env var to point at the real CLI binary
- Run 'caveman start' manually to see the underlying launch failure directly
Example fix
// before: stale binary path export CAVEMAN_CLI_BIN=/usr/local/bin/caveman-old // after unset CAVEMAN_CLI_BIN # or point at the installed binary export CAVEMAN_CLI_BIN=/usr/local/bin/caveman
Defensive patterns
Strategy: try-catch
Validate before calling
const bin = process.env.CAVEMAN_CLI_BIN ?? 'caveman';
await fs.promises.access(bin, fs.constants.X_OK).catch(() => { throw new Error(`CLI not executable: ${bin}`); }); Try / catch
try {
await startCaveRuntime();
} catch (e) {
if (String(e.message).includes('Cave Runtime failed to start')) {
console.error('Check CAVEMAN_CLI_BIN / PATH:', e.message);
} else throw e;
} Prevention
- Install the CLI via caveman setup --install and verify with 'caveman --version'
- Keep CAVEMAN_CLI_BIN accurate across upgrades
- Add a startup health check that the CLI binary exists and is executable
When it happens
Trigger: portableInvocation(command, ['start'], ...) throws while building the spawn invocation — typically because the resolved 'caveman' binary is missing or CAVEMAN_CLI_BIN points to a nonexistent/unusable path.
Common situations: Caveman CLI not installed or not on PATH; CAVEMAN_CLI_BIN set to a stale path after a reinstall; cross-platform launch (Windows vs POSIX) where the binary name is wrong.
Related errors
- caveman agent: Cave Runtime did not become ready at
- caveman-cloud MCP changed after setup; refusing destructive…
- caveman-cloud MCP changed during interrupted setup…
- caveman-cloud MCP changed during interrupted removal…
- caveman-cloud MCP postflight mismatch
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/e0ebfcdb4c23c42c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/runtime.ts:5240
`cave_gateway_identity_unverified: non-loopback gateway ${gatewayURL} requires https`,
);
}
const identity = await gatewayIdentity(gatewayURL, fetchImpl);
if (identity !== undefined) return identity.providerBilling;
throw new Error(
`cave_gateway_identity_unverified: ${gatewayURL}/health/ready did not identify as caveman-proxy`,
);
}
const readyBilling = await runtimeReady(gatewayURL, fetchImpl);
if (readyBilling !== undefined) return readyBilling;
const command = process.env.CAVEMAN_CLI_BIN ?? "caveman";
let startupFailure: Error | undefined;
let invocation;
try {
invocation = portableInvocation(command, ["start"], { env: buildRuntimeControlEnv() });
} catch (error) {
throw new Error(`caveman agent: Cave Runtime failed to start (${error instanceof Error ? error.message : String(error)})`);
}
const child = spawn(invocation.command, [...invocation.args], {
detached: true,
windowsHide: true,
stdio: "ignore",
env: buildRuntimeControlEnv(),
});
child.once("error", (error) => {
startupFailure = (error as NodeJS.ErrnoException).code === "ENOENT"
? new Error(
"caveman agent: Caveman CLI not found; run npm install, then caveman setup --install",
)
: new Error(`caveman agent: Cave Runtime failed to start (${error.message})`);
});
child.once("exit", (code, signal) => {
if (startupFailure !== undefined || code === 0) return;
startupFailure = new Error(
`caveman agent: Cave Runtime failed to start (caveman start exited ${signal ?? code}); run caveman setup --install`,View on GitHub (pinned to 3ee70a1026)