JuliusBrussee/caveman · error · Error

names source unit that is not a member of task family

Error message

${at} names source unit ${entry.source_unit_id} that is not a member of task family ${family.id}

What it means

The dataset case's source unit exists in the report (passed the unitsByID check) but is not a member of the task family currently being validated (familyUnits). This validator enforces that every dataset case's source belongs to the same task family as the dataset's declared family id, so cross-family sources are rejected.

Solutions

  1. Move or remove the offending case so every case's source unit belongs to the declared family.
  2. Regenerate the dataset scoped to family ${family.id} from the current report.
  3. If the family assignment is wrong, update the family's unit membership in the report.
  4. Check you are not validating one family's dataset against another family's configuration.

Example fix

// before
dataset.family = "auth-family"; case.source_unit_id = "unit-from-billing-family";
// after
// keep only cases whose source_unit_id is listed in the auth-family unit set,
// or reassign the unit to auth-family in the report
Defensive patterns

Strategy: validation

Validate before calling

const familyUnits = new Set(report.units.filter(u => u.family_id === family.id).map(u => u.id));
for (const c of dataset.cases) {
  if (!familyUnits.has(c.source_unit_id)) throw new Error(`case ${c.id} outside family ${family.id}`);
}

Try / catch

try {
  validateContinuousImprovement(report, dataset);
} catch (e) {
  if (String(e.message).includes("not a member of task family")) {
    // filter cases to family membership or fix family assignment
  }
}

Prevention

When it happens

Trigger: A dataset declaring family X contains a case whose source_unit_id resolves to a unit that belongs to a different family in the report — typically after reassigning units to families in the report, or mixing cases copied from another family's dataset.

Common situations: Hand-editing family membership in the report; merging datasets across families; a family's unit set was narrowed and old cases were left behind.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/05c25ec4071a02a3. Report an issue: GitHub.

Appendix: source

Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:262

    // unit of this case's own task family, and its generator and perturbation
    // must agree. A generated case whose source unit cannot be resolved would be
    // invented evidence wearing an adversarial label.
    const dataset = item.eval_pack.dataset;
    const generatorPerturbation = new Map([
      ["recorded_case.v1", "none"],
      ["boundary_guard_threshold.v1", "guard_threshold_boundary"],
      ["adversarial_misleading_tool_output.v1", "misleading_tool_output"],
      ["adversarial_stale_input.v1", "stale_input"],
    ]);
    const roleCounts = { target_failure: 0, prior_success: 0, boundary: 0, adversarial: 0 };
    const recordedSources = new Set();
    const datasetCaseIDs = new Set();
    for (const entry of dataset.cases) {
      const at = `${where} dataset case ${entry.id}`;
      if (datasetCaseIDs.has(entry.id)) throw new Error(`${at} appears twice in the dataset`);
      datasetCaseIDs.add(entry.id);
      if (!unitsByID.has(entry.source_unit_id)) throw new Error(`${at} names source unit ${entry.source_unit_id} that is not an analysis unit of this report`);
      if (!familyUnits.has(entry.source_unit_id)) throw new Error(`${at} names source unit ${entry.source_unit_id} that is not a member of task family ${family.id}`);
      if (generatorPerturbation.get(entry.generator) !== entry.perturbation) {
        throw new Error(`${at} generator ${entry.generator} disagrees with perturbation ${entry.perturbation}`);
      }
      if (entry.perturbation === "none" && entry.id !== entry.source_unit_id) {
        throw new Error(`${at} replays a recorded flow but is not identified by its source unit`);
      }
      if (entry.perturbation !== "none" && entry.id !== `${entry.generator}:${entry.source_unit_id}`) {
        throw new Error(`${at} is a generated case whose id does not name its generator and source unit`);
      }
      roleCounts[entry.role] += 1;
      if (entry.role === "target_failure" || entry.role === "prior_success") recordedSources.add(entry.source_unit_id);
    }
    for (const entry of dataset.cases) {
      // Leakage: a generated case must not perturb a unit the manifest already
      // replays unperturbed.
      if (entry.perturbation !== "none" && recordedSources.has(entry.source_unit_id)) {
        throw new Error(`${where} generated case ${entry.id} perturbs a unit the dataset already replays unperturbed`);
      }

View on GitHub (pinned to 3ee70a1026)