{"record":{"id":"32ce43ebe01ba672","repo":"SonarSource/sonarqube","slug":"hazelcast-must-not-be-enabled-on-elasticsearch-nod","errorCode":null,"errorMessage":"Hazelcast must not be enabled on Elasticsearch node","messagePattern":"Hazelcast must not be enabled on Elasticsearch node","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java","lineNumber":58,"sourceCode":"  private String nodeName;\n  private int port;\n  private ProcessId processId;\n  private String networkInterface;\n  private String members;\n  private final JoinConfigurationType type;\n\n  public HazelcastMemberBuilder(JoinConfigurationType type) {\n    this.type = type;\n  }\n\n  public HazelcastMemberBuilder setNodeName(String s) {\n    this.nodeName = s;\n    return this;\n  }\n\n  public HazelcastMemberBuilder setProcessId(ProcessId p) {\n    if (p == ProcessId.ELASTICSEARCH) {\n      throw new IllegalArgumentException(\"Hazelcast must not be enabled on Elasticsearch node\");\n    }\n    this.processId = p;\n    return this;\n  }\n\n  public HazelcastMemberBuilder setPort(int i) {\n    this.port = i;\n    return this;\n  }\n\n  public HazelcastMemberBuilder setNetworkInterface(String s) {\n    this.networkInterface = s;\n    return this;\n  }\n\n  /**\n   * Adds references to cluster members\n   */","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java#L40-L76","documentation":"HazelcastMemberBuilder.setProcessId rejects ProcessId.ELASTICSEARCH because the Elasticsearch node must not join the Hazelcast cluster; Hazelcast membership is only for app/ce/web/search coordination nodes. Passing ES as the process id is a programming/configuration error.","triggerScenarios":"Calling hazelcastMemberBuilder.setProcessId(ProcessId.ELASTICSEARCH) while wiring up cluster components, then build()/create() of the member.","commonSituations":"Refactoring cluster bootstrap code and accidentally wiring the ES node into the Hazelcast member builder; copy-pasting member construction from the search/app node setup.","solutions":["Do not create a Hazelcast member for the Elasticsearch process; remove that builder call for the ES node.","Use the correct ProcessId (APP, CE, WEB, SEARCH) for the node being built.","If ES needs coordination, use its own discovery mechanism (zen/unicast) instead of Hazelcast."],"exampleFix":"// before\nnew HazelcastMemberBuilder(...).setProcessId(ProcessId.ELASTICSEARCH).create();\n// after\nnew HazelcastMemberBuilder(...).setProcessId(ProcessId.SEARCH).create();","handlingStrategy":"validation","validationCode":"void safeSetProcessId(HazelcastMemberBuilder b, ProcessId p) {\n  if (p == ProcessId.ELASTICSEARCH) {\n    throw new IllegalArgumentException(\"ES node must not join Hazelcast\");\n  }\n  b.setProcessId(p);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never wire the Elasticsearch process into Hazelcast member construction.","Keep a single factory method that maps ProcessId to member builders and excludes ELASTICSEARCH.","Add a unit test asserting setProcessId(ELASTICSEARCH) throws for regression safety."],"tags":["illegal-argument","hazelcast","elasticsearch"],"backgroundTag":"invalid-argument-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}