JuliusBrussee/caveman · error · Error

generator disagrees with perturbation

Error message

${at} generator ${entry.generator} disagrees with perturbation ${entry.perturbation}

What it means

The generatorPerturbation map records, per generator, which perturbation it is supposed to produce. This throw fires when a dataset case's entry.perturbation differs from the perturbation its entry.generator is registered to apply — a generator/perturbation mismatch that would mislabel how the case was derived.

Solutions

  1. Set entry.perturbation to the value registered for entry.generator in generatorPerturbation.
  2. Or switch entry.generator to the generator registered for the desired perturbation.
  3. Regenerate the case programmatically instead of editing fields independently.
  4. Check generator naming against the current version's generator registry.

Example fix

// before
{ "generator": "stale-input-generator", "perturbation": "guard_threshold_boundary" }
// after
{ "generator": "stale-input-generator", "perturbation": "stale_input" }
Defensive patterns

Strategy: validation

Validate before calling

const generatorPerturbation = new Map(Object.entries(GENERATORS));
for (const c of dataset.cases) {
  if (generatorPerturbation.get(c.generator) !== c.perturbation) throw new Error(`case ${c.id}: generator/perturbation mismatch`);
}

Try / catch

try {
  validateContinuousImprovement(report, dataset);
} catch (e) {
  if (String(e.message).includes("disagrees with perturbation")) {
    // align generator and perturbation fields from the generator registry
  }
}

Prevention

When it happens

Trigger: A manifest entry sets perturbation to e.g. "stale_input" while referencing a generator whose registered perturbation is "guard_threshold_boundary" (or "none"); usually from hand-editing one field without the other.

Common situations: Manual manifest editing; a script changed the perturbation field but reused an old generator string; generator naming changed between tool versions.

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/6cb90ba3ac1aada2. Report an issue: GitHub.

Appendix: source

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

    // 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)