JuliusBrussee/caveman · error · Error

is a generated case whose id does not name its generator…

Error message

${at} is a generated case whose id does not name its generator and source unit

What it means

Generated (perturbed) cases must be identified as "<generator>:<source_unit_id>" so the id records both how and from what the case was derived. This throw fires when a case with perturbation other than "none" has an id that is not exactly that composite string.

Solutions

  1. Rewrite entry.id as `${entry.generator}:${entry.source_unit_id}`.
  2. If the id was correct under an old generator name, update entry.generator to the current name so the composite matches.
  3. Regenerate the case with the tooling rather than editing fields separately.

Example fix

// before
{ "id": "case-42", "generator": "stale-input-gen", "source_unit_id": "unit_abc", "perturbation": "stale_input" }
// after
{ "id": "stale-input-gen:unit_abc", "generator": "stale-input-gen", "source_unit_id": "unit_abc", "perturbation": "stale_input" }
Defensive patterns

Strategy: validation

Validate before calling

for (const c of dataset.cases) {
  if (c.perturbation !== "none" && c.id !== `${c.generator}:${c.source_unit_id}`) {
    throw new Error(`generated case ${c.id} must be named generator:source_unit_id`);
  }
}

Try / catch

try {
  validateContinuousImprovement(report, dataset);
} catch (e) {
  if (String(e.message).includes("does not name its generator and source unit")) {
    // rewrite id as `${generator}:${source_unit_id}`
  }
}

Prevention

When it happens

Trigger: A case's perturbation is not "none" but its id is a bare source unit id, an arbitrary label, or uses a different separator/casing than `${entry.generator}:${entry.source_unit_id}`.

Common situations: Hand-editing perturbation from "none" to a generated value without updating the id; renaming generators so old composite ids no longer match; writing ids manually instead of via the generator tooling.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

      ["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`);
      }
    }

    // Manifest composition arithmetic (spec 18.2): target-failure + prior-success
    // + one boundary + up to two adversarial, each capped and each recomputable.
    //
    // The boundary and stale-input generators perturb the localization evidence
    // a confidence guard reads. A ChangeSet whose applicability never reads that
    // evidence has no threshold to sit beside, so those two cases must NOT be

View on GitHub (pinned to 3ee70a1026)