JuliusBrussee/caveman · error · Error
supporting variant belongs to another task family
Error message
${where} supporting variant ${variantID} belongs to another task family What it means
A motif's supporting variants must all belong to the motif's own task family. The validator compares variant.task_family_id with motif.task_family_id and throws when they differ, so family-scoped structural metrics stay coherent.
Solutions
- Remove the cross-family variant from the motif's variant_ids (and fix support_variant_count).
- Re-derive the motif only from variants whose task_family_id matches the motif's.
- Fix the motif's task_family_id if it was recorded incorrectly.
Example fix
// before
{ "task_family_id": "fa", "variant_ids": ["v-fa", "v-fb"] }
// after
{ "task_family_id": "fa", "variant_ids": ["v-fa"] } Defensive patterns
Strategy: validation
Validate before calling
for (const m of report.motifs) {
const byId = new Map(report.workflow_variants.map(v => [v.id, v]));
for (const id of m.variant_ids) if (byId.get(id)?.task_family_id !== m.task_family_id) throw new Error(`motif ${m.id}: variant ${id} is cross-family`);
} Type guard
const motifVariantsSameFamily = (motif, report) => motif.variant_ids.every(id => report.workflow_variants.find(v => v.id === id)?.task_family_id === motif.task_family_id);
Try / catch
try { validateContinuousImprovement(report); } catch (e) { if (String(e.message).includes('belongs to another task family')) { console.error('Drop the cross-family variant or fix the motif family id'); } else throw e; } Prevention
- Filter supporting variants by task_family_id during motif mining
- Re-derive motifs after reassigning variants between families
- Validate family coherence as part of the fixture generator
When it happens
Trigger: A motif lists a variantID whose workflow variant entry has a different task_family_id than the motif's task_family_id.
Common situations: Motif mining that grouped across family boundaries; a variant reassigned to a different family after motif generation; motif task_family_id corrected without re-filtering its variants.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- references a task family that is not in this report
- references workflow variant that is not in this report
- carries more shared unit ids than its shared unit count
- causal slice references a workflow variant that is not in…
- operations are not a contiguous subsequence of variant 's…
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/f24b86b815ef93d0.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:117
throw new Error(`${where} probability_a_given_b ${relationship.probability_a_given_b} != ${expectedAGivenB}`);
}
}
relationshipCount += report.relationships.length;
// A motif is a structural count over variants this report carries, so every
// part of it must be re-derivable from those variants.
const variantsByID = new Map(report.workflow_variants.map((variant) => [variant.id, variant]));
const familyIDs = new Set(report.task_families.map((family) => family.id));
for (const motif of report.motifs) {
const where = `report fixture ${reportPaths[index]}: motif ${motif.id}`;
if (!familyIDs.has(motif.task_family_id)) throw new Error(`${where} references a task family that is not in this report`);
if (motif.support_variant_count !== motif.variant_ids.length) throw new Error(`${where} support variant count disagrees with its variant ids`);
let runs = 0;
let weighted = 0;
for (const variantID of motif.variant_ids) {
const variant = variantsByID.get(variantID);
if (!variant) throw new Error(`${where} references workflow variant ${variantID} that is not in this report`);
if (variant.task_family_id !== motif.task_family_id) throw new Error(`${where} supporting variant ${variantID} belongs to another task family`);
if (!contiguouslyContains(variant.signature, motif.operations)) {
throw new Error(`${where} operations are not a contiguous subsequence of variant ${variantID}'s signature`);
}
runs += variant.eligible_runs;
weighted += (motif.operations.length / variant.signature.length) * variant.eligible_runs;
}
if (motif.support_run_count !== runs) throw new Error(`${where} support run count ${motif.support_run_count} != ${runs}`);
const expectedShare = runs > 0 ? weighted / runs : 0;
if (Math.abs(motif.structural_cost_share - expectedShare) > 1e-6) {
throw new Error(`${where} structural_cost_share ${motif.structural_cost_share} != ${expectedShare}`);
}
}
motifCount += report.motifs.length;
// The causal investigation of every case: the cohort's arms, the traces it
// selected from them, and the backward hard-dependency slice.
const unitsByID = new Map(report.analysis_units.map((unit) => [unit.id, unit]));
const familiesByID = new Map(report.task_families.map((family) => [family.id, family]));View on GitHub (pinned to 3ee70a1026)