ruvnet/ruflo · error · PodTemplateValidationError

bench.successCriteria must have ≥1 entry

Error message

bench.successCriteria must have ≥1 entry

What it means

Thrown by validatePodBench() when bench.successCriteria is a valid array but has zero entries. A bench must have at least one acceptance criterion — an empty criteria list would make Darwin /loop scoring vacuous, so the schema enforces ≥1.

Solutions

  1. Add at least one concrete, measurable criterion string to bench.successCriteria
  2. If the pod genuinely has no success definition yet, finish defining it before registering the template — the schema intentionally blocks criterion-less pods
  3. Use the /bench/successCriteria path from the error to locate the list
  4. Lint in CI so placeholder templates can't ship

Example fix

// before
"bench": { "name": "b", "description": "d", "successCriteria": [], "scheduleHours": 24 }
// after
"bench": { "name": "b", "description": "d", "successCriteria": ["≥1 closed deal per month"], "scheduleHours": 24 }
Defensive patterns

Strategy: validation

Validate before calling

const criteria = (template.bench as { successCriteria?: string[] }).successCriteria ?? [];
if (criteria.length === 0) fail('bench.successCriteria needs at least one measurable criterion');

Type guard

function hasAtLeastOneCriterion(bench: unknown): boolean {
  return typeof bench === 'object' && bench !== null &&
    Array.isArray((bench as { successCriteria?: unknown[] }).successCriteria) &&
    ((bench as { successCriteria: unknown[] }).successCriteria.length > 0);
}

Try / catch

try {
  validatePodTemplate(template);
} catch (e) {
  if (e instanceof PodTemplateValidationError && e.message.includes('must have ≥1 entry')) {
    fail('A bench without acceptance criteria makes /loop scoring meaningless — add one');
  } else throw e;
}

Prevention

When it happens

Trigger: validatePodTemplate() with "successCriteria": [] (all other bench fields fine). The earlier requireArray check passes because [] is an array; only the length check catches it.

Common situations: Templates scaffolded with empty placeholder lists to 'fill in later'; programmatic generation that filters out all criteria for some pods; users assuming criteria are optional decoration.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/597ae633051ccb45. Report an issue: GitHub.

Appendix: source

Thrown at v3/@claude-flow/cli/src/business-pods/pod-schema.ts:147

    role: requireString(item, 'role', path),
    agentType: requireString(item, 'agentType', path),
    description: requireString(item, 'description', path),
    preferLocal: requireBoolean(item, 'preferLocal', path),
  };
}

function validatePodBench(item: unknown, path: string): PodBench {
  if (!isObject(item)) throw new PodTemplateValidationError('bench must be an object', path);
  const name = requireString(item, 'name', path);
  const description = requireString(item, 'description', path);
  const successCriteria = requireArray(item, 'successCriteria', path, (s, sp) => {
    if (typeof s !== 'string' || s.length === 0) {
      throw new PodTemplateValidationError('successCriteria entries must be non-empty strings', sp);
    }
    return s;
  });
  if (successCriteria.length === 0) {
    throw new PodTemplateValidationError('bench.successCriteria must have ≥1 entry', path);
  }
  const scheduleHours = requireNumber(item, 'scheduleHours', path);
  if (scheduleHours < 1) {
    throw new PodTemplateValidationError('bench.scheduleHours must be ≥1', path);
  }
  return { name, description, successCriteria, scheduleHours };
}

function validateAuditReadView(item: unknown, path: string): PodAuditReadView {
  if (!isObject(item)) {
    throw new PodTemplateValidationError('auditReadView must be an object', path);
  }
  const includedEventTypes = requireArray(item, 'includedEventTypes', path, (s, sp) => {
    if (typeof s !== 'string' || s.length === 0) {
      throw new PodTemplateValidationError('includedEventTypes entries must be non-empty strings', sp);
    }
    return s;
  });

View on GitHub (pinned to fa13ee4ad6)