{"record":{"id":"e239c28b3de2b62f","repo":"JuliusBrussee/caveman","slug":"cave-incomplete-evidence-pi-emitted-no-final-assi","errorCode":null,"errorMessage":"cave_incomplete_evidence: Pi emitted no final assistant message","messagePattern":"cave_incomplete_evidence: Pi emitted no final assistant message","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/runtime.ts","lineNumber":2107,"sourceCode":"    }\n    if (ladderFailure) throw ladderFailure;\n    if (spendFailure) throw spendFailure;\n    if (usageFailure !== undefined &&\n        (efficiencyPlan !== undefined ||\n          executionContext.spendLedgers.length > 0 ||\n          usageFailure.message === \"cave_provider_model_identity_mismatch\" ||\n          usageFailure.message === \"cave_provider_identity_missing\")) {\n      throw usageFailure;\n    }\n    if (pendingSpendReservations.length > 0) {\n      markSpendIncomplete(executionContext.spendLedgers);\n      throw new Error(\"cave_subagent_spend_evidence_incomplete\");\n    }\n    // A run stopped before its first call has no assistant message, and that is\n    // the honest outcome rather than missing evidence: the caller gets an empty\n    // answer, zero usage, and the reason the runtime declined to spend.\n    if (!finalMessage && stopReason === undefined) {\n      throw new Error(\"cave_incomplete_evidence: Pi emitted no final assistant message\");\n    }\n    if (finalMessage &&\n        (finalMessage.stopReason === \"error\" || finalMessage.stopReason === \"aborted\")) {\n      throw new Error(`cave_provider_terminal_${finalMessage.stopReason}`);\n    }\n    const text = finalMessage === undefined ? \"\" : assistantText(finalMessage);\n    if (definition.output?.schema && finalMessage !== undefined) {\n      let parsed: unknown;\n      try {\n        parsed = JSON.parse(text);\n      } catch {\n        throw new Error(\"cave_output_schema_invalid_json\");\n      }\n      if (!Value.Check(definition.output.schema, parsed)) {\n        throw new Error(\"cave_output_schema_mismatch\");\n      }\n    }\n    if (appliedPlan.appliedTransformIDs.length > 0 && !cacheBoundaryKnown) {","sourceCodeStart":2089,"sourceCodeEnd":2125,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/packages/agent/src/runtime.ts#L2089-L2125","documentation":"Evidence guard at the end of a streaming run: no final assistant message was emitted and no stop reason was recorded, so the run cannot prove what it spent or produced. This is a harness/protocol failure, not a user-input error.","triggerScenarios":"Thrown at packages/agent/src/runtime.ts:2107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the run; a dropped stream or provider glitch can produce an empty transcript","Check network/provider status that could truncate the response","Report with the trace if it reproduces — it indicates an upstream SDK/provider bug"],"exampleFix":null,"handlingStrategy":"retry","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-14T00:17:10.932Z"}