languagetool-org/languagetool · error · IllegalArgumentException

Invalid value for maxCheckThreads, must be >= 1:

Error message

Invalid value for maxCheckThreads, must be >= 1: 

What it means

maxCheckThreads controls the server's check thread pool and must be at least 1. A parsed value below 1 (e.g. 0 or negative) triggers this IllegalArgumentException. The default is 10 when the property is absent.

Source

Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java:364

        maxPort = Integer.parseInt(getOptionalProperty(props, "maxPort", "0"));
        String url = getOptionalProperty(props, "serverURL", null);
        setServerURL(url);
        String ruleIdToConfidence = getOptionalProperty(props, "ruleIdToConfidenceFile", null);
        if (ruleIdToConfidence != null) {
          ruleIdToConfidenceFile = new File(ruleIdToConfidence);
        }
        String langModel = getOptionalProperty(props, "languageModel", null);
        if (langModel != null && loadLangModel) {
          setLanguageModelDirectory(langModel);
        }
        String fasttextModel = getOptionalProperty(props, "fasttextModel", null);
        String fasttextBinary = getOptionalProperty(props, "fasttextBinary", null);
        if (fasttextBinary != null && fasttextModel != null) {
          setFasttextPaths(fasttextModel, fasttextBinary);
        }
        maxCheckThreads = Integer.parseInt(getOptionalProperty(props, "maxCheckThreads", "10"));
        if (maxCheckThreads < 1) {
          throw new IllegalArgumentException("Invalid value for maxCheckThreads, must be >= 1: " + maxCheckThreads);
        }
        // default value 0 = use maxCheckThreads setting (for compatibility)
        maxTextCheckerThreads = Integer.parseInt(getOptionalProperty(props, "maxTextCheckerThreads", "0"));
        if (maxTextCheckerThreads < 0) {
          throw new IllegalArgumentException("Invalid value for maxTextCheckerThreads, must be >= 1: " + maxTextCheckerThreads);
        }
        textCheckerQueueSize = Integer.parseInt(getOptionalProperty(props, "textCheckerQueueSize", "8"));
        if (textCheckerQueueSize < 0) {
          throw new IllegalArgumentException("Invalid value for textCheckerQueueSize, must be >= 1: " + textCheckerQueueSize);
        }

        boolean atdMode = getOptionalProperty(props, "mode", "LanguageTool").equalsIgnoreCase("AfterTheDeadline");
        if (atdMode) {
          throw new IllegalArgumentException("The AfterTheDeadline mode is not supported anymore in LanguageTool 3.8 or later");
        }
        String rulesConfigFilePath = getOptionalProperty(props, "rulesFile", null);
        if (rulesConfigFilePath != null) {
          rulesConfigFile = new File(rulesConfigFilePath);

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Set maxCheckThreads to a positive integer (e.g. 10) in the properties file
  2. Remove the property to use the default of 10
  3. Size the value to CPU cores; do not use 0 to limit load — use rate limiting instead

Example fix

# before
maxCheckThreads=0
# after
maxCheckThreads=10
Defensive patterns

Strategy: validation

Validate before calling

int t = Integer.parseInt(props.getProperty("maxCheckThreads", "10"));
if (t < 1) throw new IllegalArgumentException("maxCheckThreads must be >= 1, got " + t);

Try / catch

try { cfg = new HTTPServerConfig(props, args); } catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Invalid value for maxCheckThreads")) { props.setProperty("maxCheckThreads", "10"); cfg = new HTTPServerConfig(props, args); } else throw e;
}

Prevention

When it happens

Trigger: Setting 'maxCheckThreads=0' or a negative number in the server properties file.

Common situations: Attempting to 'disable' threading by setting 0 (not supported); unit confusion; leftover test values in production config.

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


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/d82096149ce6dc34. Report an issue: GitHub.