{"record":{"id":"3b521dde78e0f409","repo":"ruvnet/ruflo","slug":"agents-must-have-1-entry","errorCode":null,"errorMessage":"agents must have ≥1 entry","messagePattern":"agents must have ≥1 entry","errorType":"validation","errorClass":"PodTemplateValidationError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/business-pods/pod-schema.ts","lineNumber":205,"sourceCode":"export function validatePodTemplate(json: unknown): PodTemplate {\n  if (!isObject(json)) {\n    throw new PodTemplateValidationError('pod-template must be a JSON object', '/');\n  }\n  const name = requireString(json, 'name', '/');\n  if (!/^[a-z][a-z0-9-]*$/.test(name)) {\n    throw new PodTemplateValidationError('name must be lowercase-kebab (e.g. \"sales\")', '/');\n  }\n  const displayName = requireString(json, 'displayName', '/');\n  const roomId = requireString(json, 'roomId', '/');\n  if (!/^[A-Za-z0-9_.\\-:/@#]+$/.test(roomId)) {\n    throw new PodTemplateValidationError(\n      'roomId may only contain [A-Za-z0-9_.\\\\-:/@#]',\n      '/',\n    );\n  }\n  const agents = requireArray(json, 'agents', '/', validatePodAgent);\n  if (agents.length === 0) {\n    throw new PodTemplateValidationError('agents must have ≥1 entry', '/');\n  }\n  const allowedMcpTools = requireArray(json, 'allowedMcpTools', '/', (t, tp) => {\n    if (typeof t !== 'string' || t.length === 0) {\n      throw new PodTemplateValidationError(\n        'allowedMcpTools entries must be non-empty strings',\n        tp,\n      );\n    }\n    return t;\n  });\n  if (allowedMcpTools.length === 0) {\n    throw new PodTemplateValidationError('allowedMcpTools must have ≥1 entry', '/');\n  }\n  const bench = validatePodBench(json.bench, '/bench');\n  const piiPolicy = requireString(json, 'piiPolicy', '/');\n  if (!PII_POLICIES.includes(piiPolicy as PiiPolicy)) {\n    throw new PodTemplateValidationError(\n      `piiPolicy must be one of: ${PII_POLICIES.join(', ')}`,","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L187-L223","documentation":"After requireArray() parses the top-level agents array (each entry already validated by validatePodAgent), validatePodTemplate() rejects an empty list. A pod is defined by its agents; zero agents means nothing can execute, so the schema requires at least one valid agent entry.","triggerScenarios":"A template with \"agents\": []. Each individual malformed agent would have thrown earlier from validatePodAgent, so reaching this error means every entry validated but the list is empty.","commonSituations":"Roster-driven template generators that filter agents by environment and end up with none; scaffolding templates shipped with an empty placeholder array; conditional agent inclusion logic that removes all agents in a staging config.","solutions":["Add at least one valid agent entry (name, model/role, and its required fields per validatePodAgent)","If a role-based filter emptied the list, widen the filter or provide a default agent","Treat 'no agents' as a build error in your template pipeline rather than shipping it"],"exampleFix":"// before\n\"agents\": []\n// after\n\"agents\": [{ \"name\": \"lead\", \"role\": \"coordinator\" }]","handlingStrategy":"try-catch","validationCode":"if (!Array.isArray(json.agents) || json.agents.length === 0) {\n  throw new Error('template must define at least one agent');\n}","typeGuard":"function hasAtLeastOneAgent(v: unknown): boolean {\n  return Array.isArray((v as { agents?: unknown[] })?.agents) && ((v as { agents: unknown[] }).agents.length > 0);\n}","tryCatchPattern":"try { validatePodTemplate(json); } catch (err) {\n  if (err instanceof PodTemplateValidationError && err.message === 'agents must have ≥1 entry') {\n    // roster filter emptied the list — add a default agent and re-validate\n  }\n}","preventionTips":["Fail template generation early when an environment filter yields zero agents","Seed new templates from a known-good example containing one agent"],"tags":["schema-validation","business-pods","agents","configuration"],"backgroundTag":"schema-validation-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}