ruvnet/ruflo · error · TypeError

Peer manifest must be a JSON object

Error message

Peer manifest must be a JSON object

What it means

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.

Source

Thrown at v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts:27

type CoordinatorGetter = () => FederationCoordinator | null;
type ContextGetter = () => PluginContext | null;

function requireCoordinator(get: CoordinatorGetter): FederationCoordinator {
  const c = get();
  if (!c) throw new Error('Federation not initialized. Run "federation init" first.');
  return c;
}

function readPeerManifest(value: unknown): FederationManifest | undefined {
  if (value === undefined) return undefined;
  if (typeof value !== 'string' || value.trim().length === 0) {
    throw new TypeError('Peer manifest must be a JSON string or file path');
  }
  const input = value.trim();
  const json = input.startsWith('{') ? input : readFileSync(input, 'utf8');
  const parsed = JSON.parse(json) as unknown;
  if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
    throw new TypeError('Peer manifest must be a JSON object');
  }
  return parsed as FederationManifest;
}

export function createCliCommands(
  getCoordinator: CoordinatorGetter,
  getContext: ContextGetter,
): CLICommandDefinition[] {
  return [
    {
      name: 'federation init',
      description: 'Generate keypair, create federation config, and start discovery',
      options: [
        { name: 'endpoint', short: 'e', description: 'WebSocket/HTTP endpoint', type: 'string', required: true },
        { name: 'node-id', short: 'n', description: 'Node identifier', type: 'string' },
        { name: 'compliance', short: 'c', description: 'Compliance mode (hipaa, soc2, gdpr, none)', type: 'string', default: 'none' },
      ],
      handler: async (args) => {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Provide a manifest whose top level is a JSON object with the required peer fields.
  2. Validate the manifest against the peer-manifest schema before submission.
Defensive patterns

Strategy: validation

When it happens

Trigger: The parsed peer manifest is valid JSON but not a JSON object (e.g. an array or scalar).

Common situations: Manifest file contains a JSON array or a bare string instead of an object with peer fields.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/1250df1db1de99f3. Report an issue: GitHub.