JuliusBrussee/caveman · error · Error
replay trial replays a case outside the composed dataset
Error message
${where} replay trial ${proof.id} replays a case outside the composed dataset What it means
Every replay trial proof must reference a dataset_case_id that exists in the composed dataset. The validator throws when a trial proof points at a case outside the dataset, meaning the replay evidence cannot be traced back to a real fixture case.
Solutions
- Update proof.dataset_case_id to a valid id from dataset.cases.
- Re-run the replay step so trial_proofs are regenerated against the current dataset.
- If the proof was copied from another item, rebuild it from that item's own dataset cases.
Example fix
// before: proof.dataset_case_id = "case-9" (removed) // after: point at an existing case item.replay.trial_proofs[0].dataset_case_id = "case-2";
Defensive patterns
Strategy: validation
Validate before calling
const idSet = new Set(dataset.cases.map((c) => c.id));
for (const proof of item.replay.trial_proofs) {
if (!idSet.has(proof.dataset_case_id)) throw new Error(`proof ${proof.id} references unknown case`);
} Prevention
- Regenerate trial proofs whenever the dataset changes.
- Never copy trial_proofs between items without remapping dataset_case_id.
- Keep dataset case ids stable across refactors.
When it happens
Trigger: Iterating item.replay.trial_proofs, validate-continuous-improvement.mjs finds proof.dataset_case_id not present in datasetCaseIDs — usually after dataset cases were renamed, removed, or the proofs were copied from another item's replay.
Common situations: Copying trial_proofs between fixture items without updating dataset_case_id; renaming dataset case ids; a regenerated dataset invalidating old proof references.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- replay manifest case is not a composed dataset case
- replay trial graded , want exactly
- names source unit that is not an analysis unit of this…
- canonical span fixture is empty
- boundary case list disagrees with the composed dataset
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/bd8c1ce745f989b3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:323
if (roleCounts.boundary > 1) throw new Error(`${where} dataset carries ${roleCounts.boundary} boundary cases, want at most one`);
if (roleCounts.adversarial > (confidenceGuard ? 2 : 1)) throw new Error(`${where} dataset carries ${roleCounts.adversarial} adversarial cases`);
if (roleCounts.boundary !== dataset.boundary_cases.length) throw new Error(`${where} boundary case list disagrees with the composed dataset`);
if (roleCounts.adversarial !== dataset.generated_cases.length) throw new Error(`${where} generated case list disagrees with the composed dataset`);
const composed = roleCounts.target_failure + roleCounts.prior_success + roleCounts.boundary + roleCounts.adversarial;
if (composed !== dataset.cases.length) throw new Error(`${where} dataset roles (${composed}) do not account for its ${dataset.cases.length} cases`);
if (dataset.replay_case_ids.length !== datasetCaseIDs.size) throw new Error(`${where} replay manifest carries ${dataset.replay_case_ids.length} ids for ${datasetCaseIDs.size} dataset cases`);
for (const datasetCaseID of dataset.replay_case_ids) {
if (!datasetCaseIDs.has(datasetCaseID)) throw new Error(`${where} replay manifest case ${datasetCaseID} is not a composed dataset case`);
}
// 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)