ruvnet/ruflo · error · TypeError

Peer manifest must be a JSON string or file path

Error message

Peer manifest must be a JSON string or file path

What it means

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.

Source

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

import type { FederationCoordinator } from './application/federation-coordinator.js';
import { JCS_SIGNATURE_PROTOCOL } from './application/inbound-dispatcher.js';
import { getTrustLevelLabel, TrustLevel } from './domain/entities/trust-level.js';
import type { FederationManifest } from './domain/services/discovery-service.js';
import { FEDERATION_PLUGIN_VERSION } from './version.js';

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',

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Pass the manifest as an inline JSON string or a valid path to a JSON file.
  2. Verify the file exists and is readable before invoking the command.
Defensive patterns

Strategy: validation

When it happens

Trigger: The peer manifest argument to a CLI command is neither a JSON string nor a readable file path.

Common situations: Passing a number/object, a typo'd path, or an unreadable file as the manifest argument.


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