{"record":{"id":"b5d8a0a631d09eba","repo":"eclipse-vertx/vert.x","slug":"quorumsize-should-be-1","errorCode":null,"errorMessage":"quorumSize should be >= 1","messagePattern":"quorumSize should be >= 1","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/VertxOptions.java","lineNumber":397,"sourceCode":"\n  /**\n   * Get the quorum size to be used when HA is enabled.\n   *\n   * @return the quorum size\n   */\n  public int getQuorumSize() {\n    return quorumSize;\n  }\n\n  /**\n   * Set the quorum size to be used when HA is enabled.\n   *\n   * @param quorumSize the quorum size\n   * @return a reference to this, so the API can be used fluently\n   */\n  public VertxOptions setQuorumSize(int quorumSize) {\n    if (quorumSize < 1) {\n      throw new IllegalArgumentException(\"quorumSize should be >= 1\");\n    }\n    this.quorumSize = quorumSize;\n    return this;\n  }\n\n  /**\n   * Get the HA group to be used when HA is enabled.\n   *\n   * @return the HA group\n   */\n  public String getHAGroup() {\n    return haGroup;\n  }\n\n  /**\n   * Set the HA group to be used when HA is enabled.\n   *\n   * @param haGroup the HA group to use","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/VertxOptions.java#L379-L415","documentation":"VertxOptions.setQuorumSize throws IllegalArgumentException with \"quorumSize should be >= 1\" when a value below 1 is supplied. The quorum size is used in clustered Vert.x deployments: it is the minimum number of nodes that must be active in the cluster before HA deployment of modules proceeds. Zero or negative quorums are nonsensical (a quorum of 0 would deploy HA modules on an empty cluster).","triggerScenarios":"new VertxOptions().setQuorumSize(0) or negative; VertxOptions.fromJson with \"quorumSize\" <= 0; cluster startup code (e.g. startVertx) deriving quorum from the number of configured nodes when that list is empty.","commonSituations":"Computing quorumSize as nodes.size()/2+1 with an empty node list; config files where quorum is intentionally 0 to 'disable' HA instead of leaving the default; migrating configs where quorumSize was omitted and defaulted incorrectly.","solutions":["Pass a quorum >= 1, typically (clusterSize / 2) + 1 for majority semantics.","To disable HA/quorum behavior, use the cluster HA options (e.g. setHa(false) or setQuorumSize only when HA is on) rather than passing 0.","Validate config JSON before fromJson so quorumSize is either absent (default 1) or >= 1."],"exampleFix":"// before\nopts.setQuorumSize(nodes.size() / 2); // 0 for empty/1-node list\n// after\nopts.setQuorumSize(Math.max(1, nodes.size() / 2 + 1));","handlingStrategy":"validation","validationCode":"int quorum = ha ? Math.max(1, nodes.size() / 2 + 1) : 1;\nif (quorum < 1) throw new IllegalArgumentException(\"quorumSize must be >= 1\");\noptions.setQuorumSize(quorum);","typeGuard":null,"tryCatchPattern":"try {\n  options.setQuorumSize(q);\n} catch (IllegalArgumentException e) {\n  throw new IllegalArgumentException(\"quorumSize in cluster config must be >= 1, got \" + q, e);\n}","preventionTips":["Derive quorum with majority math that floors at 1 for small clusters","Disable HA via setHa(false), not via quorumSize = 0","Test clustered startup with 0-, 1-, and N-node configurations"],"tags":["vertx","cluster","ha","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}