JuliusBrussee/caveman · error
cave_subagent_framework_runner_required
cave_subagent_framework_runner_required
Error message
cave_subagent_framework_runner_required
What it means
The `subagent()` tool's execute body is a deliberate placeholder that always throws `cave_subagent_framework_runner_required`. Subagent execution requires a framework-level runner (the host agent/SDK integration) to be wired in; the plain tool returned by `subagent()` cannot run the child loop itself. Hitting this error means the tool was invoked without that runner being installed.
Solutions
- Run the agent through the caveman framework entrypoint so the runner is attached before the subagent tool executes.
- In tests, substitute a stub executor or use the framework's provided test harness instead of invoking execute directly.
- Check for a newer/patched version of the caveman runtime if you believe the runner should already be wired (internal invariant breach).
Example fix
// before
const subagentTool = subagent({ name: "helper" });
await subagentTool.execute({ task: "do work" }); // throws
// after
import { createAgent } from "@caveman/agent"; // framework bootstrap wires the runner
const agent = createAgent({ tools: [subagent({ name: "helper" })] });
await agent.run("delegate: do work"); Defensive patterns
Strategy: try-catch
Validate before calling
// Detect the placeholder executor before invoking:
async function runSubagentTool(t, input) {
let fired = false;
const probe = (...a) => { fired = true; throw new Error("abort-probe"); };
// simpler: only call execute inside the framework-hosted agent
return t.execute(input);
} Type guard
const isPlaceholderSubagent = (t) => t.execute.length === 0 && t.name != null; // heuristic; prefer running via framework
Try / catch
try {
result = await subagentTool.execute({ task });
} catch (e) {
if (e.message === "cave_subagent_framework_runner_required") {
throw new Error("Subagent tool used outside the caveman framework; run via createAgent/ensureCaveRuntime", { cause: e });
}
throw e;
} Prevention
- Never invoke tool.execute directly for subagent tools; always run through the framework's agent loop
- In tests, register a stub runner or use the framework's test harness
- Pin and bootstrap the runtime (ensureCaveRuntime) before dispatching any tool calls
- Treat this error as an integration bug: it should be unreachable in production wiring
When it happens
Trigger: Calling the subagent tool directly (e.g. `tool.execute({ task })`) outside the framework that patches in a real runner; using `subagent()` in a standalone script or custom loop that never attaches the caveman runtime/runner.
Common situations: Testing the subagent tool in isolation with a hand-rolled agent loop; running under an older or custom harness that predates runner wiring; forgetting to call the framework bootstrap (e.g. ensureCaveRuntime or equivalent) before running the agent.
Related errors
- MCP changes require the ownership transaction
- cannot safely launch non-Node Windows command shim
- cave_claude_subagent_bridge_unavailable
- cave_memory_shared_backend_unavailable
- Native model does not support bindTools
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/c9278e87c68c6b05.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/index.ts:204
}
return tool({
name: options.name,
description: options.description,
input: schema.object({ task: schema.string() }),
effect: "read",
result: "auto",
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
runtime: {
kind: "subagent",
definition: options.agent,
maxInputChars,
maxCalls,
maxCostUsd,
...(options.maxTokens === undefined ? {} : { maxTokens: options.maxTokens }),
maxContextTokens,
},
async execute() {
throw new Error("cave_subagent_framework_runner_required");
},
});
}
View on GitHub (pinned to 3ee70a1026)