{"record":{"id":"22801d00b786a275","repo":"ruvnet/ruflo","slug":"consensus-is-disabled-22801d","errorCode":null,"errorMessage":"Consensus is disabled","messagePattern":"Consensus is disabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/swarm/src/federation-hub.ts","lineNumber":668,"sourceCode":"  getMessages(limit: number = 100): FederationMessage[] {\n    return this.messages.slice(-limit);\n  }\n\n  // ==========================================================================\n  // Federation Consensus\n  // ==========================================================================\n\n  /**\n   * Propose a value for federation-wide consensus\n   */\n  async propose(\n    proposerId: SwarmId,\n    type: string,\n    value: unknown,\n    timeoutMs: number = 30000\n  ): Promise<ConsensusProposal> {\n    if (!this.config.enableConsensus) {\n      throw new Error('Consensus is disabled');\n    }\n\n    const proposal: ConsensusProposal = {\n      id: `proposal_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n      proposerId,\n      type,\n      value,\n      votes: new Map([[proposerId, true]]),\n      status: 'pending',\n      createdAt: new Date(),\n      expiresAt: new Date(Date.now() + timeoutMs),\n    };\n\n    this.proposals.set(proposal.id, proposal);\n    this.stats.consensusProposals++;\n    this.emitEvent('consensus_started', proposerId);\n\n    // Request votes from all active swarms","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/federation-hub.ts#L650-L686","documentation":"Thrown by FederationHub.propose() when the hub was constructed with enableConsensus false (or the flag not set). propose() is the entry point for federation-wide consensus, so the guard rejects any consensus attempt on a hub that was never configured for it. The check runs before the proposal object is created, so no state is mutated.","triggerScenarios":"Constructing a FederationHub with a config that lacks enableConsensus: true, then calling await hub.propose(proposerId, type, value). Any wrapper that forwards proposals to the hub (federation coordinators, consensus clients) hits the same guard.","commonSituations":"Copying a minimal FederationHubConfig sample that omits the flag; consensus disabled for performance in one environment and that config reused where propose() is called; version upgrades that introduce the flag with old configs defaulting to disabled.","solutions":["Set enableConsensus: true in the FederationHubConfig passed to the FederationHub constructor, before calling propose()","Verify the config object you build is the one the hub receives; partial spreads or merges with defaults can silently drop the flag","If federation-wide consensus is not needed, replace propose() calls with direct peer or message-bus coordination APIs"],"exampleFix":"// before\nconst hub = new FederationHub({ nodeId: 'node-1' });\nawait hub.propose(proposerId, 'deploy', { region: 'eu' }); // throws: Consensus is disabled\n\n// after\nconst hub = new FederationHub({ nodeId: 'node-1', enableConsensus: true });\nawait hub.propose(proposerId, 'deploy', { region: 'eu' });","handlingStrategy":"validation","validationCode":"function assertConsensusAvailable(config: { enableConsensus?: boolean }): void {\n  if (!config.enableConsensus) {\n    throw new Error('FederationHub consensus is disabled: set enableConsensus: true before calling propose()');\n  }\n}\n\nassertConsensusAvailable(hubConfig);\nawait hub.propose(proposerId, type, value);","typeGuard":"function canPropose(config: { enableConsensus?: boolean }): boolean {\n  return config.enableConsensus === true;\n}","tryCatchPattern":"try {\n  await hub.propose(proposerId, type, value);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Consensus is disabled') {\n    // configuration problem, not transient: use non-consensus coordination\n    return fallbackToDirectCoordination();\n  }\n  throw err;\n}","preventionTips":["Keep one typed FederationHubConfig factory so enableConsensus cannot be dropped by partial spreads","Add a startup smoke test that proposes a no-op value when consensus is expected to be available","Treat this message as a config error in logs and never retry it"],"tags":["federation","consensus","config","feature-flag"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}