{"record":{"id":"ea1f0f30a62ee646","repo":"ruvnet/ruflo","slug":"peer-manifest-must-be-a-json-string-or-file-path","errorCode":null,"errorMessage":"Peer manifest must be a JSON string or file path","messagePattern":"Peer manifest must be a JSON string or file path","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts","lineNumber":21,"sourceCode":"import type { FederationCoordinator } from './application/federation-coordinator.js';\nimport { JCS_SIGNATURE_PROTOCOL } from './application/inbound-dispatcher.js';\nimport { getTrustLevelLabel, TrustLevel } from './domain/entities/trust-level.js';\nimport type { FederationManifest } from './domain/services/discovery-service.js';\nimport { FEDERATION_PLUGIN_VERSION } from './version.js';\n\ntype 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',","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts#L3-L39","documentation":"readPeerManifest() requires the --peer-manifest value to be either an inline JSON string or a path to a JSON file. The value supplied was not a non-empty string (wrong type or blank), so it can be neither parsed as JSON nor read from disk.","triggerScenarios":"The peer manifest argument to a CLI command is neither a JSON string nor a readable file path.","commonSituations":"Passing a number/object, a typo'd path, or an unreadable file as the manifest argument.","solutions":["Pass the manifest as an inline JSON string or a valid path to a JSON file.","Verify the file exists and is readable before invoking the command."],"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"}