SonarSource/sonarqube · error · MessageException
Worker count '%s' is invalid. It must be an integer strictly
Error message
Worker count '%s' is invalid. It must be an integer strictly greater than 0 and less or equal to 10
What it means
CeConfigurationImpl.readWorkerCount validates the sonar.ce.workerCount setting at startup. Compute Engine accepts only an integer from 1 (DEFAULT_WORKER_COUNT) up to 10 (MAX_WORKER_THREAD_COUNT); anything else throws this MessageException and blocks CE startup. The message reminds that the value must be strictly >0 and <=10.
Source
Thrown at server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java:83
public CeConfigurationImpl(Configuration configuration, @Nullable WorkerCountProvider workerCountProvider) {
this.workerCountProvider = workerCountProvider;
this.gracefulStopTimeoutInMs = configuration.getLong(CE_GRACEFUL_STOP_TIMEOUT.getKey())
.orElse(Long.parseLong(CE_GRACEFUL_STOP_TIMEOUT.getDefaultValue()));
this.queuePollingDelay = configuration.getLong(PROPERTY_QUEUE_POLLING_DELAY)
.orElse(DEFAULT_QUEUE_POLLING_DELAY);
if (workerCountProvider == null) {
this.workerCount = DEFAULT_WORKER_COUNT;
this.workerThreadCount = DEFAULT_WORKER_THREAD_COUNT;
} else {
this.workerCount = readWorkerCount(workerCountProvider);
this.workerThreadCount = MAX_WORKER_THREAD_COUNT;
}
}
private static synchronized int readWorkerCount(WorkerCountProvider workerCountProvider) {
int value = workerCountProvider.get();
if (value < DEFAULT_WORKER_COUNT || value > MAX_WORKER_THREAD_COUNT) {
throw parsingError(value);
}
return value;
}
private static MessageException parsingError(int value) {
return MessageException.of(format(
"Worker count '%s' is invalid. It must be an integer strictly greater than 0 and less or equal to 10",
value));
}
@Override
public int getWorkerMaxCount() {
return workerThreadCount;
}
@Override
public int getWorkerCount() {
if (workerCountProvider != null) {View on GitHub (pinned to 184c821202)
Solutions
- Set sonar.ce.workerCount to an integer between 1 and 10 in sonar.properties.
- Remove the property entirely to fall back to the default worker count.
- If more throughput is needed, scale horizontally with additional CE nodes instead of raising the per-node cap.
- Restart Compute Engine after correcting the property.
Example fix
// sonar.properties before sonar.ce.workerCount=32 // after sonar.ce.workerCount=4
Defensive patterns
Strategy: validation
Validate before calling
// shell: validate before putting in sonar.properties count=<value> if ! [[ "$count" =~ ^[0-9]+$ ]] || [ "$count" -lt 1 ] || [ "$count" -gt 10 ]; then echo "sonar.ce.workerCount must be 1..10"; exit 1; fi
Try / catch
try {
int workers = ceConfiguration.getWorkerCount();
} catch (MessageException e) {
LOG.error("Fix sonar.ce.workerCount (1-10), defaulting", e);
} Prevention
- Keep sonar.ce.workerCount between 1 and 10
- Omit the property to use the default instead of setting 0 to 'disable' CE
- Scale horizontally with extra CE nodes rather than exceeding the cap
- Validate sonar.properties in CI/deploy scripts before restart
When it happens
Trigger: Starting SonarQube with sonar.ce.workerCount set to 0, a negative number, a value above 10, or (via the WorkerCountProvider) any out-of-range configured value; note that 0 fails here because the check is value < DEFAULT_WORKER_COUNT (1).
Common situations: Operator tried to 'disable' CE by setting workerCount=0; copy-pasted a sizing recommendation with a huge value (e.g. 32) on a big cluster; typo like -1; setting applied in sonar.properties without realizing the hard cap of 10.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid Azure URL or Personal Access Token
- Your global Bitbucket Server configuration is incomplete.
- Missing URL
- Invalid URL, %s
- Invalid appId;
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/784bf0500d18ed7f.
Report an issue: GitHub.