{"record":{"id":"96287c897b7de2d5","repo":"JuliusBrussee/caveman","slug":"canonical-span-index-ajv-errorstext-validate","errorCode":null,"errorMessage":"canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}","messagePattern":"canonical span (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":336,"sourceCode":"    const perturbed = dataset.cases.some((entry) => entry.perturbation !== \"none\");\n    if (perturbed !== item.eval_pack.graders.includes(\"guard_respected\")) {\n      throw new Error(`${where} guard_respected grader ${perturbed ? \"missing for\" : \"declared without\"} perturbed dataset cases`);\n    }\n    for (const proof of item.replay.trial_proofs) {\n      if (!datasetCaseIDs.has(proof.dataset_case_id)) throw new Error(`${where} replay trial ${proof.id} replays a case outside the composed dataset`);\n      for (const arm of [proof.baseline, proof.candidate]) {\n        const graders = arm.grader_results.map((grader) => grader.grader).sort();\n        const required = [...item.eval_pack.graders].sort();\n        if (graders.join(\",\") !== required.join(\",\")) {\n          throw new Error(`${where} replay trial ${proof.id} graded ${graders.join(\",\")}, want exactly ${required.join(\",\")}`);\n        }\n      }\n    }\n  }\n}\nif (!Array.isArray(spans) || spans.length === 0) throw new Error(\"canonical span fixture is empty\");\nfor (const [index, span] of spans.entries()) {\n  if (!validateSpan(span)) throw new Error(`canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}`);\n}\nif (relationshipCount === 0) throw new Error(\"no theme relationship reached the shared-analysis-unit threshold in any fixture\");\nif (motifCount === 0) throw new Error(\"no workflow motif recurred across two variants of one task family in any fixture\");\nconsole.log(`validated ${reports.length} generated improvement report(s), ${relationshipCount} theme relationship(s), ${motifCount} workflow motif(s) and ${spans.length} canonical spans`);\n","sourceCodeStart":318,"sourceCodeEnd":341,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L318-L341","documentation":"Error \"canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:336 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the canonical span so it validates against the span schema."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}