JuliusBrussee/caveman · error
caveman trial proxy did not become ready on
Error message
caveman trial proxy did not become ready on ${host}:${port} What it means
`waitForPort` polls the trial proxy's host:port every 100ms until a timeout elapses. If the port never accepts connections within the deadline, the CLI concludes the trial proxy failed to start and throws this error.
Solutions
- Check the proxy process logs/stderr for a startup crash and fix the underlying cause (missing config, bad key).
- Verify the host:port is reachable (`nc -z <host> <port>`) and that no firewall blocks the port.
- Retry the trial command once to rule out transient slow startup; ensure the binary is installed/updated via `caveman setup --install`.
Example fix
// before (shell) caveman trial # proxy listens on 127.0.0.1 but firewall blocks it // error: caveman trial proxy did not become ready on 127.0.0.1:8080 // after (shell) sudo ufw allow 8080/tcp caveman trial
Defensive patterns
Strategy: retry
Validate before calling
// shell if ! nc -z 127.0.0.1 8080 2>/dev/null; then echo "trial port not listening; check proxy logs before retrying" fi
Try / catch
// js
try {
await startTrialProxy();
} catch (e) {
if (String(e.message).includes("did not become ready")) {
logProxyStderr();
await sleep(1000);
return startTrialProxy(); // retry once after surfacing child logs
}
throw e;
} Prevention
- Ensure the chosen port is free and allowed by firewall/VPN before starting trials.
- Check proxy child process stderr on every failed start.
- Run trials on warm environments to avoid cold-start timeouts.
When it happens
Trigger: Starting the `caveman trial` flow when the spawned proxy process fails to bind its port (crash on startup, port blocked by firewall, wrong host, or startup slower than the timeout).
Common situations: Port already occupied or blocked by a firewall/VPN; proxy binary crashes immediately due to missing config; slow machine or container cold start exceeding the readiness timeout.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- AbortError
- awscreds: request failed
- cave_agent_tool_timeout | cave_network_error
- cave response was not valid JSON
- caveman agent: Cave Runtime did not become ready at
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/33a8b78a650262ce.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:16953
function freePort(): Promise<number> {
return new Promise((resolve, reject) => {
const server = netCreateServer();
server.on("error", reject);
server.listen(0, "127.0.0.1", () => {
const addr = server.address() as AddressInfo;
server.close(() => resolve(addr.port));
});
});
}
async function waitForPort(host: string, port: number, timeoutMs: number): Promise<void> {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
if (await portListening(host, port)) return;
await sleep(100);
}
throw new Error(`caveman trial proxy did not become ready on ${host}:${port}`);
}
function waitForChild(child: ReturnType<typeof spawn>, timeoutMs: number): Promise<void> {
return new Promise((resolve) => {
let done = false;
const finish = () => {
if (done) return;
done = true;
resolve();
};
child.once("exit", finish);
child.once("close", finish);
setTimeout(() => {
try { child.kill("SIGKILL"); } catch {}
finish();
}, timeoutMs).unref();
});
}View on GitHub (pinned to 3ee70a1026)