JuliusBrussee/caveman · error
caveman-code: host command shell is not available
Error message
caveman-code: host command shell is not available
What it means
The bash/host-command tool in packages/agent/src/code.ts runs the requested shell command via runProcess inside the workspace root with a timeout. If the shell process cannot be spawned at all (spawnFailed), it throws 'caveman-code: host command shell is not available' — the environment provides no usable shell executable.
Solutions
- Install or restore a shell in the runtime image (e.g. RUN apt-get install -y bash or apk add bash).
- Ensure the shell binary is on the PATH visible to the agent process.
- Check sandbox/seccomp policies allow process spawning (fork/exec) for the agent.
- Run the agent from a standard base image (node:22-slim, debian-slim) rather than scratch/distroless.
- Avoid shell-dependent tools in environments where process execution is intentionally disabled.
Example fix
# before FROM scratch # after FROM debian:bookworm-slim # provides /bin/sh
Defensive patterns
Strategy: validation
Validate before calling
const { execFileSync } = require("child_process");
try { execFileSync("/bin/sh", ["-c", "true"], { stdio: "ignore" }); }
catch { throw new Error("No usable shell in this environment"); } Try / catch
try {
await bash({ command });
} catch (e) {
if (e.message.includes("host command shell is not available")) {
console.error("Runtime image has no shell; use an image with /bin/sh or disable shell tools.");
} else throw e;
} Prevention
- Use a base image that ships a shell (debian/alpine-based, not scratch/distroless).
- Confirm sandbox policies permit fork/exec before enabling shell tools.
- Smoke-test process spawning (`/bin/sh -c true`) in container startup checks.
- Keep the shell binary on the PATH visible to the agent process.
When it happens
Trigger: Invoking the bash tool on a host where /bin/sh or the configured shell binary is missing (distroless images, scratch containers), or spawning fails due to PATH issues, missing execute permission, or a sandbox that blocks process creation.
Common situations: Running the agent in a scratch/distroless container without a shell; hardened sandboxes (seccomp/AppArmor) blocking exec; misconfigured PATH after customizing the runtime environment; shell removed for hardening in CI images.
Related errors
- bounded_response_unavailable
- cave_sandbox_conformance_failed
- CAVE_SETUP_TIMEOUT must be a positive integer
- cave_transform_registry_unavailable
- caveman agent: multiple provider credentials found; set…
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/37c40253d61d80ed.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/code.ts:316
`Times out after ${BASH_TIMEOUT_MS} ms; output is capped at ${caps.bash} bytes.`,
input: schema.object({
command: schema.string(),
timeoutMs: schema.optional(schema.integer()),
}),
effect: "external",
result: "inline",
timeoutMs: BASH_TIMEOUT_MS,
async execute(input, signal) {
const timeoutMs = Math.min(input.timeoutMs ?? BASH_TIMEOUT_MS, BASH_TIMEOUT_MS);
const shell = hostShellInvocation(input.command, process.platform, buildCodingProcessEnv());
const run = await runProcess(
shell.command,
shell.args,
await workspaceRoot(),
timeoutMs,
signal,
);
if (run.spawnFailed) throw new Error("caveman-code: host command shell is not available");
const body = [
`exit ${run.timedOut ? `timeout after ${timeoutMs}ms` : run.code}`,
run.output.trim() === "" ? "(no output)" : run.output,
].join("\n");
const text = capOutput(body, caps.bash);
record(`bash:${input.command.slice(0, 60)}`, text);
return text;
},
});
const editTool = tool({
name: "edit_file",
description:
"Replace an exact string in a workspace file. The old string must appear exactly " +
"once unless replace_all is set. Writes to disk.",
input: schema.object({
path: schema.string(),
old_string: schema.string(),View on GitHub (pinned to 3ee70a1026)