JuliusBrussee/caveman · error

caveman build: seeds must be a non-empty unique set

Error message

caveman build: seeds must be a non-empty unique set

What it means

compile validates the seed list used to vary candidate-plan evaluation: it must be non-empty and contain no duplicates. Duplicate or empty seeds would double-run or skip evaluation axes and skew pass-rate math, so the library fails fast.

Solutions

  1. Pass a non-empty array of unique integers, or omit input.seeds to use the default [1,2,3,4,5]
  2. Deduplicate before calling: [...new Set(seeds)]
  3. Guard length and uniqueness before compile: seeds.length > 0 && new Set(seeds).size === seeds.length
  4. Fix generators that produce repeated seeds (e.g. off-by-one ranges)

Example fix

// before
compile({ ..., seeds: [1, 1, 2] }); // throws
// after
compile({ ..., seeds: [...new Set([1, 1, 2])] });
Defensive patterns

Strategy: validation

Validate before calling

const seeds = input.seeds ?? [1, 2, 3, 4, 5];
if (seeds.length === 0 || new Set(seeds).size !== seeds.length) {
  throw new Error("seeds must be non-empty and unique");
}

Type guard

function isValidSeeds(v: unknown): v is number[] {
  return Array.isArray(v) && v.length > 0 &&
    new Set(v).size === v.length && v.every((s) => Number.isSafeInteger(s));
}

Prevention

When it happens

Trigger: Passing input.seeds as an empty array, or an array with repeated values (e.g. [1,1,2]); omitted seeds default to [1,2,3,4,5] and never fail.

Common situations: Building a seed list programmatically with collisions; slicing/mapping another array and producing duplicates; passing [] to mean "no seeds" instead of omitting the field.

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/207a569e5090bbad. Report an issue: GitHub.

Appendix: source

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

export async function compile(input: CompileInput): Promise<CompileResult> {
  // An unsandboxed run cannot produce a lock. Host mode runs tool
  // closures in the host process, so its evidence shows no containment and is
  // refused here rather than downgraded to a soft status. The whole definition
  // graph is checked, not just the root: a host subagent under a fixture root
  // runs its closures in this process exactly as a host root would, and the CLI
  // saves that lock all the same. Coding agents lock by compiling against
  // fixture corpora with a contained sandbox mode.
  if (graphUsesHostSandbox(input.agent)) {
    throw new Error("cave_host_sandbox_lock_ineligible");
  }
  const approved = input.evals.filter((fixture) => fixture.approved && fixture.required);
  if (approved.length === 0) {
    return emptyResult("needs_eval", "no approved required eval fixture");
  }
  const seeds = input.seeds ?? [1, 2, 3, 4, 5];
  if (seeds.length === 0 || new Set(seeds).size !== seeds.length) {
    throw new Error("caveman build: seeds must be a non-empty unique set");
  }
  const candidates = input.candidates ?? generateCandidatePlans(
    input.agent,
    input.contextIR,
    input.baselinePlan,
    input.modelCandidates ?? [input.baselinePlan.model],
    true,
    new Map(),
    ENGINE_TRANSFORM_CAPABILITIES,
    new Set(input.evals.some((fixture) =>
      fixture.quality.some((grader) => grader.type === "tool_called"))
      ? ["history", "tool_result"] as ContextKind[]
      : []),
    // The public compile() enforces the same model/safety policy and catalog
    // pricing the CLI does — an unpriced or policy-denied model is rejected
    // here, not only in the CLI.
    {
      ...(input.config.allowedModels === undefined ? {} : { allowedModels: input.config.allowedModels }),

View on GitHub (pinned to 3ee70a1026)