ruvnet/ruflo · error · PodTemplateValidationError

pod-template at ${path}: bench must be an object

Error message

pod-template at ${path}: bench must be an object

What it means

Thrown by validatePodBench() when the top-level bench field is not a plain object (null, array, string, number, undefined). The bench object must contain name, description, successCriteria, and scheduleHours. isObject() excludes null and arrays.

Source

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

  const v = parent[key];
  if (!Array.isArray(v)) {
    throw new PodTemplateValidationError(`field "${key}" must be an array`, path);
  }
  return v.map((item, idx) => itemValidator(item, `${path}/${key}[${idx}]`));
}

function validatePodAgent(item: unknown, path: string): PodAgent {
  if (!isObject(item)) throw new PodTemplateValidationError('agent must be an object', path);
  return {
    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 };
}

View on GitHub (pinned to 6b01dc5a68)

Solutions

  1. Read the error path (/bench) confirming the field is missing or malformed
  2. Provide a full bench object: { "name": "...", "description": "...", "successCriteria": [...], "scheduleHours": N }
  3. Copy the bench block from a known-good reference template (e.g., the sales pod)

Example fix

// before:
"bench": "weekly revenue check" // string, throws

// after:
"bench": {
  "name": "sales-bench",
  "description": "Weekly pipeline revenue check",
  "successCriteria": ["Pipeline value increased"],
  "scheduleHours": 168
}
Defensive patterns

Strategy: validation

Validate before calling

import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';

try {
  const pod = validatePodTemplate(parsedJson);
} catch (e) {
  if (e instanceof PodTemplateValidationError) {
    console.error(`Bench error at ${e.path}: ${e.message}`);
  }
}

Try / catch

import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';

try {
  const pod = validatePodTemplate(raw);
} catch (e) {
  if (e instanceof PodTemplateValidationError) {
    console.error(e.message); // path is /bench
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: validatePodTemplate() reads json.bench and passes it to validatePodBench(); the value is null, an array, a string, or undefined (missing).

Common situations: The bench field was omitted from the template entirely; bench was set to a string description instead of a structured object; a malformed template from an external source.

Related errors


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/bc6873608c2f4378. Report an issue: GitHub.