{"record":{"id":"a1e891ab26fc91c2","repo":"JuliusBrussee/caveman","slug":"cave-context-body-missing-segment-id","errorCode":null,"errorMessage":"cave_context_body_missing:${segment.id}","messagePattern":"cave_context_body_missing:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/cli.ts","lineNumber":854,"sourceCode":"      return \"run caveman login, then npm run build\";\n    case \"search_budget_exceeded\":\n      return \"raise maxSearchCostUsd or narrow allowed models, then run npm run build\";\n    case \"no_passing_build\":\n      return \"keep baseline and inspect failing eval evidence\";\n    case \"incomplete_evidence\":\n      return \"fix missing terminal usage or grader evidence, then run npm run build\";\n  }\n}\n\nasync function profilePreferredTransforms(\n  lowered: Awaited<ReturnType<typeof lowerContext>>,\n): Promise<ReadonlyMap<string, string>> {\n  const preferred = new Map<string, string>();\n  for (const segment of lowered.ir.segments) {\n    if (segment.safety !== \"S4\" ||\n        /(?:opaque|signed|signature|jwt|token|cipher|encrypted)/i.test(segment.id)) continue;\n    const body = lowered.bodies.get(segment.bodyHandle);\n    if (!body) throw new Error(`cave_context_body_missing:${segment.id}`);\n    const type = await detectEngineType(body);\n    if (/^[a-z0-9-]+$/.test(type) && type !== \"unknown\") {\n      preferred.set(segment.id, `caveman.engine.${type}.v1`);\n    }\n  }\n  return preferred;\n}\n\nasync function detectEngineType(input: Uint8Array): Promise<string> {\n  const command = process.env.CAVEMAN_ENGINE_BIN ?? \"caveman-engine\";\n  return new Promise((accept, reject) => {\n    const env = buildEngineEnv();\n    const invocation = portableInvocation(command, [\"detect\"], { env });\n    const child = spawn(invocation.command, [...invocation.args], {\n      env,\n      stdio: [\"pipe\", \"pipe\", \"pipe\"],\n    });\n    const stdout: Buffer[] = [];","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/packages/agent/src/cli.ts#L836-L872","documentation":"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.","triggerScenarios":"Thrown at packages/agent/src/cli.ts:854 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}