{"record":{"id":"3eab403fb835a44a","repo":"ruvnet/ruflo","slug":"pod-template-at-path-agent-must-be-an-object","errorCode":null,"errorMessage":"pod-template at ${path}: agent must be an object","messagePattern":"pod-template at (.+?): agent must be an object","errorType":"validation","errorClass":"PodTemplateValidationError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/business-pods/pod-schema.ts","lineNumber":127,"sourceCode":"function requireBoolean(parent: Record<string, unknown>, key: string, path: string): boolean {\n  const v = parent[key];\n  if (typeof v !== 'boolean') {\n    throw new PodTemplateValidationError(`field \"${key}\" must be a boolean`, path);\n  }\n  return v;\n}\n\nfunction requireArray<T>(parent: Record<string, unknown>, key: string, path: string,\n                          itemValidator: (item: unknown, ipath: string) => T): T[] {\n  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  });","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/business-pods/pod-schema.ts#L109-L145","documentation":"Thrown by validatePodAgent() when an element inside the agents array is not a plain object (null, an array, a string, a number, etc.). Each agent entry must be an object with role, agentType, description, and preferLocal fields. The isObject() helper excludes null and arrays, so only genuine plain objects pass.","triggerScenarios":"validatePodTemplate() iterates the agents array via requireArray() and one element is null, a primitive, or a nested array.","commonSituations":"A trailing comma in YAML producing a null entry; an agent entry that is a bare string (\"lead-gen-agent\"); a copy-paste error inserting an array where an object was expected.","solutions":["Read the error path — it includes the array index (e.g., /agents[2]) pinpointing the bad entry","Ensure every agents[] element is a full object with role, agentType, description, and preferLocal"],"exampleFix":"// before:\n\"agents\": [ { \"role\": \"lead\", ... }, null ] // second entry is null, throws\n\n// after:\n\"agents\": [ { \"role\": \"lead\", ... }, { \"role\": \"researcher\", \"agentType\": \"researcher\", ... } ]","handlingStrategy":"validation","validationCode":"import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';\n\ntry {\n  const pod = validatePodTemplate(parsedJson);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError) {\n    // e.path includes the array index, e.g. /agents[2]\n    console.error(`Agent entry error at ${e.path}: ${e.message}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"import { validatePodTemplate, PodTemplateValidationError } from '@claude-flow/cli/business-pods/pod-schema';\n\ntry {\n  const pod = validatePodTemplate(raw);\n} catch (e) {\n  if (e instanceof PodTemplateValidationError) {\n    console.error(e.message); // path includes /agents[idx]\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Ensure every element in the agents array is a full object with role, agentType, description, and preferLocal","Watch for null entries from trailing commas in YAML","Validate templates with validatePodTemplate() before deployment"],"tags":["validation","pod-template","schema","agents"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}