JuliusBrussee/caveman · error

caveman build: requiredFixturePassRate must be in (0,1]

Error message

caveman build: requiredFixturePassRate must be in (0,1]

What it means

defineBuild validates that requiredFixturePassRate is strictly greater than 0 and at most 1, since it represents a fraction of eval fixtures that must pass. Zero would make the gate meaningless and values above 1 are impossible. The throw happens synchronously at definition time so bad configs fail fast.

Solutions

  1. Set requiredFixturePassRate to a fraction in (0,1], e.g. 0.95 for 95%
  2. Convert percentage inputs with value / 100 before passing
  3. Guard the computed value: if (!Number.isFinite(rate) || rate <= 0 || rate > 1) fix upstream
  4. Check the config source (env/JSON) is not supplying 0 as a placeholder

Example fix

// before
defineBuild({ entry, evals, requiredFixturePassRate: 95 });
// after
defineBuild({ entry, evals, requiredFixturePassRate: 0.95 });
Defensive patterns

Strategy: validation

Validate before calling

const rate = options.requiredFixturePassRate;
if (!(Number.isFinite(rate) && rate > 0 && rate <= 1)) {
  throw new Error(`requiredFixturePassRate must be a fraction in (0,1], got ${rate}`);
}

Type guard

function isValidPassRate(v: unknown): v is number {
  return typeof v === "number" && Number.isFinite(v) && v > 0 && v <= 1;
}

Prevention

When it happens

Trigger: Passing requiredFixturePassRate <= 0 (e.g. 0, or a negative number), > 1 (e.g. 50 instead of 0.5), or a value that is NaN (NaN comparisons are false, so !(...) triggers).

Common situations: Confusing percentage (50) with fraction (0.5); copy-pasting a config where the field defaulted to 0; computing the rate dynamically and dividing by zero to get NaN.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at packages/agent/src/build.ts:47

      "caveman build: dataResidency is not enforced yet; refusing to ignore residency policy",
    );
  }
  const config: BuildConfig = {
    entry: options.entry,
    evals: options.evals,
    efficiency: options.efficiency ?? "max",
    requiredFixturePassRate: options.requiredFixturePassRate ?? 1,
    qualityRetention: options.qualityRetention ?? 0.98,
    maxSearchCostUsd: options.maxSearchCostUsd ?? 2,
    lock: options.lock ?? "strict",
    sandbox: options.sandbox ?? "required",
    ...(options.allowedModels === undefined ? {} : { allowedModels: [...options.allowedModels] }),
    ...(options.deniedModels === undefined ? {} : { deniedModels: [...options.deniedModels] }),
    ...(options.maxP95LatencyMs === undefined ? {} : { maxP95LatencyMs: options.maxP95LatencyMs }),
    ...(options.forbiddenSafetyClasses === undefined ? {} : { forbiddenSafetyClasses: [...options.forbiddenSafetyClasses] }),
  };
  if (!(config.requiredFixturePassRate > 0 && config.requiredFixturePassRate <= 1)) {
    throw new Error("caveman build: requiredFixturePassRate must be in (0,1]");
  }
  if (!(config.qualityRetention > 0 && config.qualityRetention <= 1)) {
    throw new Error("caveman build: qualityRetention must be in (0,1]");
  }
  if (!(config.maxSearchCostUsd > 0)) {
    throw new Error("caveman build: maxSearchCostUsd must be positive");
  }
  return Object.freeze(config);
}

export interface CavePlan {
  schema_version: 1;
  plan_id: string;
  model: string;
  reasoning: "none" | "minimal" | "low" | "medium" | "high";
  segment_routes: Array<{
    segment_kind: ContextKind;
    segment_id?: string;

View on GitHub (pinned to 3ee70a1026)