JuliusBrussee/caveman · error · Error
cave_context_body_missing
Error message
cave_context_body_missing:${segment.id} What it means
Lowering guard: the context segment identified by the interpolated id reached transform profiling without a resolvable body. The segment's source configuration (its content could not be loaded) is at fault, not the profiling code.
Solutions
- Ensure the context segment named in the message has resolvable, non-empty source content
- Fix the source path or provider for that context segment
- Check file reads/globs feeding the segment's body
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/agent/src/cli.ts:854 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/a1e891ab26fc91c2.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/cli.ts:854
return "run caveman login, then npm run build";
case "search_budget_exceeded":
return "raise maxSearchCostUsd or narrow allowed models, then run npm run build";
case "no_passing_build":
return "keep baseline and inspect failing eval evidence";
case "incomplete_evidence":
return "fix missing terminal usage or grader evidence, then run npm run build";
}
}
async function profilePreferredTransforms(
lowered: Awaited<ReturnType<typeof lowerContext>>,
): Promise<ReadonlyMap<string, string>> {
const preferred = new Map<string, string>();
for (const segment of lowered.ir.segments) {
if (segment.safety !== "S4" ||
/(?:opaque|signed|signature|jwt|token|cipher|encrypted)/i.test(segment.id)) continue;
const body = lowered.bodies.get(segment.bodyHandle);
if (!body) throw new Error(`cave_context_body_missing:${segment.id}`);
const type = await detectEngineType(body);
if (/^[a-z0-9-]+$/.test(type) && type !== "unknown") {
preferred.set(segment.id, `caveman.engine.${type}.v1`);
}
}
return preferred;
}
async function detectEngineType(input: Uint8Array): Promise<string> {
const command = process.env.CAVEMAN_ENGINE_BIN ?? "caveman-engine";
return new Promise((accept, reject) => {
const env = buildEngineEnv();
const invocation = portableInvocation(command, ["detect"], { env });
const child = spawn(invocation.command, [...invocation.args], {
env,
stdio: ["pipe", "pipe", "pipe"],
});
const stdout: Buffer[] = [];View on GitHub (pinned to 766dce6b13)