{"record":{"id":"70a96702a42d46ea","repo":"ruvnet/ruflo","slug":"bench-must-be-an-object","errorCode":null,"errorMessage":"bench must be an object","messagePattern":"bench must be an object","errorType":"validation","errorClass":"PodTemplateValidationError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/business-pods/pod-schema.ts","lineNumber":137,"sourceCode":"  const v = parent[key];\n  if (!Array.isArray(v)) {\n    throw new PodTemplateValidationError(`field \"${key}\" must be an array`, path);\n  }\n  return v.map((item, idx) => itemValidator(item, `${path}/${key}[${idx}]`));\n}\n\nfunction validatePodAgent(item: unknown, path: string): PodAgent {\n  if (!isObject(item)) throw new PodTemplateValidationError('agent must be an object', path);\n  return {\n    role: requireString(item, 'role', path),\n    agentType: requireString(item, 'agentType', path),\n    description: requireString(item, 'description', path),\n    preferLocal: requireBoolean(item, 'preferLocal', path),\n  };\n}\n\nfunction validatePodBench(item: unknown, path: string): PodBench {\n  if (!isObject(item)) throw new PodTemplateValidationError('bench must be an object', path);\n  const name = requireString(item, 'name', path);\n  const description = requireString(item, 'description', path);\n  const successCriteria = requireArray(item, 'successCriteria', path, (s, sp) => {\n    if (typeof s !== 'string' || s.length === 0) {\n      throw new PodTemplateValidationError('successCriteria entries must be non-empty strings', sp);\n    }\n    return s;\n  });\n  if (successCriteria.length === 0) {\n    throw new PodTemplateValidationError('bench.successCriteria must have ≥1 entry', path);\n  }\n  const scheduleHours = requireNumber(item, 'scheduleHours', path);\n  if (scheduleHours < 1) {\n    throw new PodTemplateValidationError('bench.scheduleHours must be ≥1', path);\n  }\n  return { name, description, successCriteria, scheduleHours };\n}\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L119-L155","documentation":"Thrown by validatePodBench() when the template's bench field is not a plain object. bench must contain name, description (non-empty strings), successCriteria (non-empty array of non-empty strings), and scheduleHours (number ≥1) — but this specific error means the container itself was wrong before field checks ran.","triggerScenarios":"validatePodTemplate() with \"bench\": null, \"bench\": \"weekly-check\", bench missing entirely (undefined fails isObject), or bench as an array.","commonSituations":"Template authored without a bench section (it is mandatory, every pod needs Darwin /loop scoring); bench reduced to a string name for brevity; optional-looking field omitted because similar configs mark it optional.","solutions":["Add a full bench object: {\"name\":\"sales-bench\",\"description\":\"...\",\"successCriteria\":[\"...\"],\"scheduleHours\":24}","Remember bench is required — there is no 'no bench' pod","Use the error path (it points at /bench) to locate the slot in your JSON","Validate in CI so missing bench sections never reach runtime"],"exampleFix":"// before\n{ \"bench\": null }\n// after\n\"bench\": { \"name\": \"sales-pipeline-bench\", \"description\": \"Weekly pipeline health\", \"successCriteria\": [\"≥10 qualified leads\"], \"scheduleHours\": 168 }","handlingStrategy":"type-guard","validationCode":"const bench = template.bench as unknown;\nif (typeof bench !== 'object' || bench === null || Array.isArray(bench)) {\n  fail('bench is required and must be an object: {name, description, successCriteria[], scheduleHours}');\n}","typeGuard":"function isPodBenchShape(v: unknown): v is { name: string; description: string; successCriteria: string[]; scheduleHours: number } {\n  if (typeof v !== 'object' || v === null || Array.isArray(v)) return false;\n  const o = v as Record<string, unknown>;\n  return typeof o.name === 'string' && typeof o.description === 'string' &&\n    Array.isArray(o.successCriteria) && typeof o.scheduleHours === 'number';\n}","tryCatchPattern":"try {\n  validatePodTemplate(template);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError && e.message.includes('bench must be an object')) {\n    fail('Every pod requires a bench section — it drives Darwin /loop scoring');\n  } else throw e;\n}","preventionTips":["Treat bench as mandatory in template scaffolds — pre-fill it, never comment it out","Start from a known-good template and edit values, not structure","Add a schema smoke-test fixture covering a bench-less template to your CI"],"tags":["pod","schema","validation","json","bench"],"backgroundTag":"schema-validation-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}