SonarSource/sonarqube · error · MessageException
Invalid value for property %s: [%s], only [%s] are allowed
Error message
Invalid value for property %s: [%s], only [%s] are allowed
What it means
ClusterSettings.toNodeType reads the mandatory property sonar.cluster.node.type and validates it against the NodeType enum. If the value is not one of the allowed node types (application, search), a MessageException listing the valid values is thrown so the operator knows exactly which values are accepted.
Source
Thrown at server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java:168
property.getKey(), String.join(", ", invalidHosts)));
}
}
private static AddressAndPort parseHost(String value) {
HostAndPort hostAndPort = HostAndPort.fromString(value);
return new AddressAndPort(hostAndPort.getHost(), hostAndPort.hasPort() ? hostAndPort.getPort() : null);
}
private AddressAndPort parseAndCheckHost(Property property, String value) {
AddressAndPort addressAndPort = parseHost(value);
checkValidHosts(property, singleton(addressAndPort));
return addressAndPort;
}
public static NodeType toNodeType(Props props) {
String nodeTypeValue = requireValue(props, CLUSTER_NODE_TYPE);
if (!NodeType.isValid(nodeTypeValue)) {
throw new MessageException(format("Invalid value for property %s: [%s], only [%s] are allowed", CLUSTER_NODE_TYPE.getKey(), nodeTypeValue,
Arrays.stream(NodeType.values()).map(NodeType::getValue).collect(joining(", "))));
}
return NodeType.parse(nodeTypeValue);
}
private static String requireValue(Props props, Property property) {
String key = property.getKey();
String value = props.value(key);
String trimmedValue = value == null ? null : value.trim();
if (trimmedValue == null || trimmedValue.isEmpty()) {
throw new MessageException(format("Property %s is mandatory", key));
}
return trimmedValue;
}
private static void ensureNoSearchNodeForbiddenSettings(Props props) {
List<String> violations = FORBIDDEN_SEARCH_NODE_SETTINGS.stream()
.filter(setting -> props.value(setting.getKey()) != null)View on GitHub (pinned to 184c821202)
Solutions
- Set sonar.cluster.node.type to exactly 'application' or 'search' in conf/sonar.properties.
- Check the error message itself: it lists the currently allowed values joined by commas; use one verbatim.
- If you intended a web/ce node, use type 'application'; if an Elasticsearch-only node, use 'search'.
Example fix
// before (conf/sonar.properties) sonar.cluster.node.type=worker // after sonar.cluster.node.type=application
Defensive patterns
Strategy: validation
Validate before calling
// shell: only the canonical values are allowed case "$SONAR_CLUSTER_NODE_TYPE" in application|search) ;; *) echo "sonar.cluster.node.type must be 'application' or 'search'"; exit 1 ;; esac
Prevention
- Only use 'application' or 'search' verbatim, lowercase
- Copy values from official docs for your exact SonarQube version
- Never invent node roles; roles are fixed by the NodeType enum
When it happens
Trigger: toNodeType is called by nodeType() and shouldStartHazelcast() (both invoked from accept during cluster configuration parsing) whenever props value for CLUSTER_NODE_TYPE fails NodeType.isValid, e.g. sonar.cluster.node.type=worker or mixed case/typo values.
Common situations: Setting sonar.cluster.node.type to a made-up role (worker, app, es) or to a value from older SonarQube versions; whitespace/case mistakes are caught here too since NodeType.isValid is case-sensitive on the canonical values.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Property [%s] is forbidden
- Property %s is mandatory
- Github configuration is not complete. Please check your conf
- Configuration is not complete : %s
- Unsupported frequency:
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/16b423d4b121159b.
Report an issue: GitHub.