ruvnet/ruflo · error

Federation not initialized. Run "federation init" first.

Error message

Federation not initialized. Run "federation init" first.

What it means

A federation CLI command needed the plugin's FederationCoordinator but the getter returned null — the federation plugin has not been initialized in this session. Initialization must happen first ('federation init') so there is a coordinator instance to route the command to.

Source

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

import { readFileSync } from 'node:fs';
import type { CLICommandDefinition, PluginContext } from '@claude-flow/shared/src/plugin-interface.js';
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(

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Run 'federation init' first to create local identity and state.
  2. Check initialization status in the CLI and prompt the user to initialize.
Defensive patterns

Strategy: validation

When it happens

Trigger: A federation CLI command runs before the federation plugin has been initialized.

Common situations: User runs a peer/session command in a fresh environment without prior 'federation init'.


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