{"record":{"id":"1250df1db1de99f3","repo":"ruvnet/ruflo","slug":"peer-manifest-must-be-a-json-object","errorCode":null,"errorMessage":"Peer manifest must be a JSON object","messagePattern":"Peer manifest must be a JSON object","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts","lineNumber":27,"sourceCode":"type CoordinatorGetter = () => FederationCoordinator | null;\ntype ContextGetter = () => PluginContext | null;\n\nfunction requireCoordinator(get: CoordinatorGetter): FederationCoordinator {\n  const c = get();\n  if (!c) throw new Error('Federation not initialized. Run \"federation init\" first.');\n  return c;\n}\n\nfunction readPeerManifest(value: unknown): FederationManifest | undefined {\n  if (value === undefined) return undefined;\n  if (typeof value !== 'string' || value.trim().length === 0) {\n    throw new TypeError('Peer manifest must be a JSON string or file path');\n  }\n  const input = value.trim();\n  const json = input.startsWith('{') ? input : readFileSync(input, 'utf8');\n  const parsed = JSON.parse(json) as unknown;\n  if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n    throw new TypeError('Peer manifest must be a JSON object');\n  }\n  return parsed as FederationManifest;\n}\n\nexport function createCliCommands(\n  getCoordinator: CoordinatorGetter,\n  getContext: ContextGetter,\n): CLICommandDefinition[] {\n  return [\n    {\n      name: 'federation init',\n      description: 'Generate keypair, create federation config, and start discovery',\n      options: [\n        { name: 'endpoint', short: 'e', description: 'WebSocket/HTTP endpoint', type: 'string', required: true },\n        { name: 'node-id', short: 'n', description: 'Node identifier', type: 'string' },\n        { name: 'compliance', short: 'c', description: 'Compliance mode (hipaa, soc2, gdpr, none)', type: 'string', default: 'none' },\n      ],\n      handler: async (args) => {","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts#L9-L45","documentation":"readPeerManifest() parsed or loaded the manifest input, but the result was not a JSON object (e.g. an array or scalar). A federation manifest must be a key-value object with node metadata, so the type check rejects the value before it reaches discovery.","triggerScenarios":"The parsed peer manifest is valid JSON but not a JSON object (e.g. an array or scalar).","commonSituations":"Manifest file contains a JSON array or a bare string instead of an object with peer fields.","solutions":["Provide a manifest whose top level is a JSON object with the required peer fields.","Validate the manifest against the peer-manifest schema before submission."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}