{"record":{"id":"784bf0500d18ed7f","repo":"SonarSource/sonarqube","slug":"worker-count-s-is-invalid-it-must-be-an-intege","errorCode":null,"errorMessage":"Worker count '%s' is invalid. It must be an integer strictly greater than 0 and less or equal to 10","messagePattern":"Worker count '(.+?)' is invalid\\. It must be an integer strictly greater than 0 and less or equal to 10","errorType":"validation","errorClass":"MessageException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java","lineNumber":83,"sourceCode":"  public CeConfigurationImpl(Configuration configuration, @Nullable WorkerCountProvider workerCountProvider) {\n    this.workerCountProvider = workerCountProvider;\n    this.gracefulStopTimeoutInMs = configuration.getLong(CE_GRACEFUL_STOP_TIMEOUT.getKey())\n      .orElse(Long.parseLong(CE_GRACEFUL_STOP_TIMEOUT.getDefaultValue()));\n    this.queuePollingDelay = configuration.getLong(PROPERTY_QUEUE_POLLING_DELAY)\n      .orElse(DEFAULT_QUEUE_POLLING_DELAY);\n    if (workerCountProvider == null) {\n      this.workerCount = DEFAULT_WORKER_COUNT;\n      this.workerThreadCount = DEFAULT_WORKER_THREAD_COUNT;\n    } else {\n      this.workerCount = readWorkerCount(workerCountProvider);\n      this.workerThreadCount = MAX_WORKER_THREAD_COUNT;\n    }\n  }\n\n  private static synchronized int readWorkerCount(WorkerCountProvider workerCountProvider) {\n    int value = workerCountProvider.get();\n    if (value < DEFAULT_WORKER_COUNT || value > MAX_WORKER_THREAD_COUNT) {\n      throw parsingError(value);\n    }\n    return value;\n  }\n\n  private static MessageException parsingError(int value) {\n    return MessageException.of(format(\n      \"Worker count '%s' is invalid. It must be an integer strictly greater than 0 and less or equal to 10\",\n      value));\n  }\n\n  @Override\n  public int getWorkerMaxCount() {\n    return workerThreadCount;\n  }\n\n  @Override\n  public int getWorkerCount() {\n    if (workerCountProvider != null) {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeConfigurationImpl.java#L65-L101","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// sonar.properties before\nsonar.ce.workerCount=32\n// after\nsonar.ce.workerCount=4","handlingStrategy":"validation","validationCode":"// shell: validate before putting in sonar.properties\ncount=<value>\nif ! [[ \"$count\" =~ ^[0-9]+$ ]] || [ \"$count\" -lt 1 ] || [ \"$count\" -gt 10 ]; then echo \"sonar.ce.workerCount must be 1..10\"; exit 1; fi","typeGuard":null,"tryCatchPattern":"try {\n  int workers = ceConfiguration.getWorkerCount();\n} catch (MessageException e) {\n  LOG.error(\"Fix sonar.ce.workerCount (1-10), defaulting\", e);\n}","preventionTips":["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"],"tags":["configuration","sonarqube","compute-engine","startup","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}