JuliusBrussee/caveman · error · Error
canonical span fixture is empty
Error message
canonical span fixture is empty
What it means
After validating improvement reports, the script requires the canonical span fixture to be a non-empty array; otherwise there are no spans to validate against the span schema. An empty or missing spans value is treated as a broken fixture rather than a vacuous pass.
Solutions
- Check that the spans fixture file loads and exports a non-empty array under the key the script reads.
- Regenerate the span fixture if a generator produced zero spans.
- Verify the fixture path/require at the top of the script points at the intended file.
- Inspect the fixture for a schema change that made the loader filter out all spans.
Example fix
// before: export const spans = []; // after: fixture regenerated with real spans export const spans = [/* canonical spans */];
Defensive patterns
Strategy: validation
Validate before calling
import { spans } from "./fixtures/spans.mjs";
if (!Array.isArray(spans) || spans.length === 0)
throw new Error("span fixture must export a non-empty array"); Type guard
function isNonEmptySpanArray(v) {
return Array.isArray(v) && v.length > 0;
} Try / catch
try {
const spans = loadSpanFixture();
if (!Array.isArray(spans) || spans.length === 0) throw new Error("empty span fixture");
} catch (err) {
console.error(`span fixture unusable: ${err.message}`);
process.exit(1);
} Prevention
- Assert non-empty fixtures at generation time, not only at validation time.
- Keep export keys stable; rename via search-and-replace across loader and fixture.
- Add a smoke test that imports every fixture and checks basic shape.
When it happens
Trigger: Running validate-continuous-improvement.mjs when the spans fixture is undefined, not an array, or an empty array — e.g. the fixture file failed to load, exports the wrong key, or its span list was emptied.
Common situations: Renaming the export key in the span fixture file; a fixture regeneration script that wrote zero spans; loading the fixture with a path that resolved to an empty/different module.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- boundary case list disagrees with the composed dataset
- cohort arm references a workflow variant that is not in…
- cohort arm uses a variant of another task family
- cohort arms are not baseline then alternative
- cohort family unit count disagrees with the task family
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/d3b09bcdb809d0ce.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:334
// The guard grader exists exactly when there is a perturbed case to catch a
// candidate on; a required grader with no case behind it is decoration.
const perturbed = dataset.cases.some((entry) => entry.perturbation !== "none");
if (perturbed !== item.eval_pack.graders.includes("guard_respected")) {
throw new Error(`${where} guard_respected grader ${perturbed ? "missing for" : "declared without"} perturbed dataset cases`);
}
for (const proof of item.replay.trial_proofs) {
if (!datasetCaseIDs.has(proof.dataset_case_id)) throw new Error(`${where} replay trial ${proof.id} replays a case outside the composed dataset`);
for (const arm of [proof.baseline, proof.candidate]) {
const graders = arm.grader_results.map((grader) => grader.grader).sort();
const required = [...item.eval_pack.graders].sort();
if (graders.join(",") !== required.join(",")) {
throw new Error(`${where} replay trial ${proof.id} graded ${graders.join(",")}, want exactly ${required.join(",")}`);
}
}
}
}
}
if (!Array.isArray(spans) || spans.length === 0) throw new Error("canonical span fixture is empty");
for (const [index, span] of spans.entries()) {
if (!validateSpan(span)) throw new Error(`canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}`);
}
if (relationshipCount === 0) throw new Error("no theme relationship reached the shared-analysis-unit threshold in any fixture");
if (motifCount === 0) throw new Error("no workflow motif recurred across two variants of one task family in any fixture");
console.log(`validated ${reports.length} generated improvement report(s), ${relationshipCount} theme relationship(s), ${motifCount} workflow motif(s) and ${spans.length} canonical spans`);
View on GitHub (pinned to 3ee70a1026)