languagetool-org/languagetool · error · IllegalArgumentException
Invalid value for maxTextCheckerThreads, must be >= 1:
Error message
Invalid value for maxTextCheckerThreads, must be >= 1:
What it means
maxTextCheckerThreads (added as a per-text checker pool, default 0 = inherit maxCheckThreads) must be >= 0; the message text says '>= 1' but the code enforces >= 0. Values below 0 throw this IllegalArgumentException.
Source
Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java:369
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);
if (!rulesConfigFile.exists() || !rulesConfigFile.isFile()) {
throw new RuntimeException("Rules Configuration file cannot be found: " + rulesConfigFile);
}
}
String remoteRulesConfigFilePath = getOptionalProperty(props, "remoteRulesFile", null);View on GitHub (pinned to 2e990059ce)
Solutions
- Set maxTextCheckerThreads to 0 (use maxCheckThreads) or a positive integer
- Remove the property to keep the default behavior
- Fix any config generator emitting negative values
Example fix
# before maxTextCheckerThreads=-1 # after maxTextCheckerThreads=0
Defensive patterns
Strategy: validation
Validate before calling
int t = Integer.parseInt(props.getProperty("maxTextCheckerThreads", "0"));
if (t < 0) throw new IllegalArgumentException("maxTextCheckerThreads must be >= 0 (0 = use maxCheckThreads), got " + t); Try / catch
try { cfg = new HTTPServerConfig(props, args); } catch (IllegalArgumentException e) {
if (e.getMessage().contains("maxTextCheckerThreads")) { props.setProperty("maxTextCheckerThreads", "0"); cfg = new HTTPServerConfig(props, args); } else throw e;
} Prevention
- Treat 0 as the valid default meaning 'inherit maxCheckThreads'
- Reject negative numbers when generating config files
- Keep thread/queue tuning values in one reviewed config block
When it happens
Trigger: Setting 'maxTextCheckerThreads' to a negative integer (e.g. -5) in the properties file.
Common situations: Config typos with minus signs; copying validation guidance ('must be >= 1') and assuming 0 is invalid — 0 is actually the documented default meaning 'use maxCheckThreads'.
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 value for maxCheckThreads, must be >= 1:
- maxWorkQueueSize must be >= 0:
- Invalid value for textCheckerQueueSize, must be >= 1:
- No rules are active. Please make sure your rule ids (<option
- suppressMisspelledMatch must be a valid regex
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/79bfaa127b361f6a.
Report an issue: GitHub.