JuliusBrussee/caveman · error

caveman build: generated no candidate plans

Error message

caveman build: generated no candidate plans

What it means

After generating candidate plans for the compile run, compile requires at least one candidate; an empty list means planning produced nothing to evaluate, so the library throws rather than returning a meaningless result. Generation is driven by the agent graph, context IR, baseline plan, and model candidates under the config's model allow/deny and safety-class constraints.

Solutions

  1. Widen allowedModels (or clear deniedModels) so at least the baselinePlan.model is permitted
  2. Remove/relax forbiddenSafetyClasses entries that reject every candidate
  3. Verify input.baselinePlan and input.modelCandidates are non-empty and reference allowed models
  4. Log generateCandidatePlans output upstream to see why planning yields zero results

Example fix

// before
config = { allowedModels: ["model-x"], ... } // baseline model-y not allowed
// after
config = { allowedModels: ["model-x", baselinePlan.model], ... }
Defensive patterns

Strategy: validation

Validate before calling

const allowed = input.config?.allowedModels;
if (allowed && !allowed.includes(input.baselinePlan.model)) {
  throw new Error("baseline model excluded by allowedModels; candidates will be empty");
}

Try / catch

try {
  const result = compile(input);
} catch (e) {
  if (e instanceof Error && e.message === "caveman build: generated no candidate plans") {
    // relax allowedModels/forbiddenSafetyClasses and retry
  } else throw e;
}

Prevention

When it happens

Trigger: generateCandidatePlans returns an empty array — e.g. the config's allowedModels/deniedModels/forbiddenSafetyClasses filter out every candidate model, the baseline plan is invalid, or the context IR yields no viable plans.

Common situations: An overly restrictive allowedModels list that excludes the baseline model; forbiddenSafetyClasses matching all candidates; a baseline plan referencing a denied model; an empty or degenerate context IR.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

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

    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 }),
      ...(input.config.deniedModels === undefined ? {} : { deniedModels: input.config.deniedModels }),
      ...(input.config.forbiddenSafetyClasses === undefined
        ? {}
        : { forbiddenSafetyClasses: input.config.forbiddenSafetyClasses }),
    },
  );
  if (candidates.length === 0) throw new Error("caveman build: generated no candidate plans");
  if (!input.entitled && candidates.some((candidate) => candidate.requires_entitlement && !candidate.static_rejection)) {
    return emptyResult("needs_login", "entitled engine required for eligible candidates");
  }

  const runnable = candidates.filter((candidate) => !candidate.static_rejection);
  const staticRejections = candidates.length - runnable.length;
  const plannedRuns = runnable.length * approved.length * seeds.length;
  const estimatedCeiling = roundUsd(
    runnable.reduce((sum, candidate) => sum + candidate.estimated_cost_usd_per_run * approved.length * seeds.length, 0),
  );
  if (estimatedCeiling > input.config.maxSearchCostUsd) {
    return {
      status: "search_budget_exceeded",
      estimated_ceiling_usd: estimatedCeiling,
      planned_runs: plannedRuns,
      completed_runs: 0,
      static_rejections: staticRejections,
      actual_cost_usd: 0,

View on GitHub (pinned to 3ee70a1026)