{"record":{"id":"3f01174b7e9eb3ae","repo":"ruvnet/ruflo","slug":"pod-template-at-path-agents-must-have-1-entry","errorCode":null,"errorMessage":"pod-template at ${path}: agents must have ≥1 entry","messagePattern":"pod-template at (.+?): 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/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L187-L223","documentation":"Thrown by validatePodTemplate() when the 'agents' array is present and valid as an array but contains zero entries. Each pod must define at least one agent composition (PodAgent with role, agentType, description, preferLocal). An empty agents array means the pod has no execution capacity.","triggerScenarios":"The pod-template JSON has \"agents\": [] — an empty array. The requireArray helper succeeds (it is a valid array), but the subsequent length check fails.","commonSituations":"An agent entry was deleted during editing and the array was left empty; a template was scaffolded with a placeholder empty agents array that was never filled in.","solutions":["Add at least one agent object to the agents array with role, agentType, description, and preferLocal fields","Verify the agentType is one of the values in KNOWN_AGENT_TYPES (e.g. 'coder', 'researcher', 'reviewer')"],"exampleFix":"// before\n{ \"agents\": [] }\n\n// after\n{ \"agents\": [\n  { \"role\": \"lead-gen-agent\", \"agentType\": \"researcher\", \"description\": \"Finds leads\", \"preferLocal\": true }\n] }","handlingStrategy":"validation","validationCode":"if (!Array.isArray(template.agents) || template.agents.length === 0) {\n  throw new Error('Pod must define at least one agent');\n}","typeGuard":"function hasAgents(template: unknown): boolean {\n  return typeof template === 'object' && template !== null &&\n    Array.isArray((template as Record<string, unknown>).agents) &&\n    ((template as Record<string, unknown>).agents as unknown[]).length > 0;\n}","tryCatchPattern":"try {\n  validatePodTemplate(json);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError && e.message.includes('agents must have')) {\n    // Add at least one agent entry\n  }\n}","preventionTips":["Never leave the agents array empty — every pod needs at least one agent","Scaffold new templates from an existing working template rather than from scratch","Run business_pod_validate before committing template changes"],"tags":["pod-template","validation","schema","agents"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}