SonarSource/sonarqube · error · IllegalArgumentException

Hazelcast must not be enabled on Elasticsearch node

Error message

Hazelcast must not be enabled on Elasticsearch node

What it means

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.

Solutions

  1. Do not create a Hazelcast member for the Elasticsearch process; remove that builder call for the ES node.
  2. Use the correct ProcessId (APP, CE, WEB, SEARCH) for the node being built.
  3. If ES needs coordination, use its own discovery mechanism (zen/unicast) instead of Hazelcast.

Example fix

// before
new HazelcastMemberBuilder(...).setProcessId(ProcessId.ELASTICSEARCH).create();
// after
new HazelcastMemberBuilder(...).setProcessId(ProcessId.SEARCH).create();
Defensive patterns

Strategy: validation

Validate before calling

void safeSetProcessId(HazelcastMemberBuilder b, ProcessId p) {
  if (p == ProcessId.ELASTICSEARCH) {
    throw new IllegalArgumentException("ES node must not join Hazelcast");
  }
  b.setProcessId(p);
}

Prevention

When it happens

Trigger: Calling hazelcastMemberBuilder.setProcessId(ProcessId.ELASTICSEARCH) while wiring up cluster components, then build()/create() of the member.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/32ce43ebe01ba672. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java:58

  private String nodeName;
  private int port;
  private ProcessId processId;
  private String networkInterface;
  private String members;
  private final JoinConfigurationType type;

  public HazelcastMemberBuilder(JoinConfigurationType type) {
    this.type = type;
  }

  public HazelcastMemberBuilder setNodeName(String s) {
    this.nodeName = s;
    return this;
  }

  public HazelcastMemberBuilder setProcessId(ProcessId p) {
    if (p == ProcessId.ELASTICSEARCH) {
      throw new IllegalArgumentException("Hazelcast must not be enabled on Elasticsearch node");
    }
    this.processId = p;
    return this;
  }

  public HazelcastMemberBuilder setPort(int i) {
    this.port = i;
    return this;
  }

  public HazelcastMemberBuilder setNetworkInterface(String s) {
    this.networkInterface = s;
    return this;
  }

  /**
   * Adds references to cluster members
   */

View on GitHub (pinned to 184c821202)