{"record":{"id":"b60b7ff65ffd6db6","repo":"ruvnet/ruflo","slug":"consensus-is-disabled","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.js","lineNumber":435,"sourceCode":"            }\n        }\n        return sent;\n    }\n    /**\n     * Get recent messages\n     */\n    getMessages(limit = 100) {\n        return this.messages.slice(-limit);\n    }\n    // ==========================================================================\n    // Federation Consensus\n    // ==========================================================================\n    /**\n     * Propose a value for federation-wide consensus\n     */\n    async propose(proposerId, type, value, timeoutMs = 30000) {\n        if (!this.config.enableConsensus) {\n            throw new Error('Consensus is disabled');\n        }\n        const proposal = {\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        this.proposals.set(proposal.id, proposal);\n        this.stats.consensusProposals++;\n        this.emitEvent('consensus_started', proposerId);\n        // Request votes from all active swarms\n        await this.broadcast(proposerId, {\n            type: 'vote_request',\n            proposalId: proposal.id,","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/federation-hub.js#L417-L453","documentation":"FederationHub.propose() throws immediately when the hub was configured with enableConsensus: false — no federation-wide vote is created and the proposal never reaches peers. Consensus (propose/vote/decide across federated swarms) is an opt-out feature that defaults to true, so this error means the running configuration explicitly disabled it.","triggerScenarios":"new FederationHub({ enableConsensus: false }) (or a config merge that evaluated the flag false) followed by any hub.propose(...) call\nDeployments that copied a minimal config object overriding defaults — the constructor spreads DEFAULT_CONFIG, but any explicit false wins\nFeature-flag/config drift between environments: consensus disabled in staging config, code path still calls propose() Shared coordinator code (e.g., unified-coordinator) that always calls propose() while some hubs run without consensus","commonSituations":"Operators disabling consensus for 'single-hub mode' or to cut overhead, later enabling features that need it\nConfig templating tools that serialize all booleans explicitly, turning the default-true into explicit false by accident\nVersion upgrades where a previously unguarded propose() call now runs against a consensus-disabled hub","solutions":["Set enableConsensus: true in the FederationHub config where federation-wide decisions are needed","If consensus must stay disabled, guard the call site: check the hub config / feature flag before propose()","Audit the effective config after construction (log this.config or the merged result) to confirm the flag's actual value","Keep one source of truth for the flag (env or config service) instead of duplicating it per environment"],"exampleFix":"// before\nconst hub = new FederationHub({ ...opts, enableConsensus: false });\nawait hub.propose(this.id, 'scale-up', { nodes: 3 }); // throws 'Consensus is disabled'\n\n// after\nconst hub = new FederationHub({ ...opts, enableConsensus: true });\nawait hub.propose(this.id, 'scale-up', { nodes: 3 });\n\n// or gate the call:\nif (hub.config.enableConsensus !== false) {\n  await hub.propose(this.id, 'scale-up', { nodes: 3 });\n} else {\n  applyLocally({ nodes: 3 }); // non-consensus fallback path\n}","handlingStrategy":"validation","validationCode":"// Check the flag through the hub's exposed config before proposing:\nif (hub.config?.enableConsensus === false) {\n  return applyLocalDecision(value); // skip consensus path entirely\n}\nawait hub.propose(proposerId, type, value);","typeGuard":"function consensusEnabled(hub) { return hub.config?.enableConsensus !== false; } // default true","tryCatchPattern":"try { await hub.propose(id, type, value); }\ncatch (e) {\n  if (e instanceof Error && e.message === 'Consensus is disabled') {\n    return fallbackToSingleHubDecision(value); // explicit degraded mode\n  }\n  throw e;\n}","preventionTips":["Log the effective enableConsensus value after hub construction to catch config-merge surprises","Keep the flag in one config source per environment (env var / config service)","Feature-detect before calling: guard propose() behind the same flag the hub was built with","When disabling consensus, audit call sites (coordinators, scale routines) that assume propose() works"],"tags":["federation","consensus","configuration","feature-flag","javascript"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}