{"record":{"id":"c401cda3fb9d8332","repo":"ruvnet/ruflo","slug":"federation-not-initialized-run-federation-init","errorCode":null,"errorMessage":"Federation not initialized. Run \"federation init\" first.","messagePattern":"Federation not initialized\\. Run \"federation init\" first\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts","lineNumber":14,"sourceCode":"import { readFileSync } from 'node:fs';\nimport type { CLICommandDefinition, PluginContext } from '@claude-flow/shared/src/plugin-interface.js';\nimport 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(","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugin-agent-federation/src/cli-commands.ts#L1-L32","documentation":"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.","triggerScenarios":"A federation CLI command runs before the federation plugin has been initialized.","commonSituations":"User runs a peer/session command in a fresh environment without prior 'federation init'.","solutions":["Run 'federation init' first to create local identity and state.","Check initialization status in the CLI and prompt the user to initialize."],"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-14T05:17:10.506Z"}