{"record":{"id":"207a569e5090bbad","repo":"JuliusBrussee/caveman","slug":"caveman-build-seeds-must-be-a-non-empty-unique-se","errorCode":null,"errorMessage":"caveman build: seeds must be a non-empty unique set","messagePattern":"caveman build: seeds must be a non-empty unique set","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/build.ts","lineNumber":235,"sourceCode":"\nexport async function compile(input: CompileInput): Promise<CompileResult> {\n  // An unsandboxed run cannot produce a lock. Host mode runs tool\n  // closures in the host process, so its evidence shows no containment and is\n  // refused here rather than downgraded to a soft status. The whole definition\n  // graph is checked, not just the root: a host subagent under a fixture root\n  // runs its closures in this process exactly as a host root would, and the CLI\n  // saves that lock all the same. Coding agents lock by compiling against\n  // fixture corpora with a contained sandbox mode.\n  if (graphUsesHostSandbox(input.agent)) {\n    throw new Error(\"cave_host_sandbox_lock_ineligible\");\n  }\n  const approved = input.evals.filter((fixture) => fixture.approved && fixture.required);\n  if (approved.length === 0) {\n    return emptyResult(\"needs_eval\", \"no approved required eval fixture\");\n  }\n  const seeds = input.seeds ?? [1, 2, 3, 4, 5];\n  if (seeds.length === 0 || new Set(seeds).size !== seeds.length) {\n    throw new Error(\"caveman build: seeds must be a non-empty unique set\");\n  }\n  const candidates = input.candidates ?? generateCandidatePlans(\n    input.agent,\n    input.contextIR,\n    input.baselinePlan,\n    input.modelCandidates ?? [input.baselinePlan.model],\n    true,\n    new Map(),\n    ENGINE_TRANSFORM_CAPABILITIES,\n    new Set(input.evals.some((fixture) =>\n      fixture.quality.some((grader) => grader.type === \"tool_called\"))\n      ? [\"history\", \"tool_result\"] as ContextKind[]\n      : []),\n    // The public compile() enforces the same model/safety policy and catalog\n    // pricing the CLI does — an unpriced or policy-denied model is rejected\n    // here, not only in the CLI.\n    {\n      ...(input.config.allowedModels === undefined ? {} : { allowedModels: input.config.allowedModels }),","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/build.ts#L217-L253","documentation":"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.","triggerScenarios":"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.","commonSituations":"Building a seed list programmatically with collisions; slicing/mapping another array and producing duplicates; passing [] to mean \"no seeds\" instead of omitting the field.","solutions":["Pass a non-empty array of unique integers, or omit input.seeds to use the default [1,2,3,4,5]","Deduplicate before calling: [...new Set(seeds)]","Guard length and uniqueness before compile: seeds.length > 0 && new Set(seeds).size === seeds.length","Fix generators that produce repeated seeds (e.g. off-by-one ranges)"],"exampleFix":"// before\ncompile({ ..., seeds: [1, 1, 2] }); // throws\n// after\ncompile({ ..., seeds: [...new Set([1, 1, 2])] });","handlingStrategy":"validation","validationCode":"const seeds = input.seeds ?? [1, 2, 3, 4, 5];\nif (seeds.length === 0 || new Set(seeds).size !== seeds.length) {\n  throw new Error(\"seeds must be non-empty and unique\");\n}","typeGuard":"function isValidSeeds(v: unknown): v is number[] {\n  return Array.isArray(v) && v.length > 0 &&\n    new Set(v).size === v.length && v.every((s) => Number.isSafeInteger(s));\n}","tryCatchPattern":null,"preventionTips":["Deduplicate seed arrays before passing them","Omit the seeds field to use safe defaults","Validate programmatic seed generation in unit tests"],"tags":["validation","seeds","duplicates"],"backgroundTag":"invalid-argument-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}