languagetool-org/languagetool · error · IllegalArgumentException
maxWorkQueueSize must be >= 0:
Error message
maxWorkQueueSize must be >= 0:
What it means
The maxWorkQueueSize property from the server configuration file is parsed and validated; negative values are rejected with this IllegalArgumentException. maxWorkQueueSize bounds the request work queue; 0 means unbounded, so it must be >= 0.
Source
Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java:343
maxCheckTimeMillisAnonymous = maxCheckTimeMillisLoggedIn = maxCheckTimeMillisPremium = Integer.parseInt(getOptionalProperty(props, "maxCheckTimeMillis", "-1"));
maxCheckTimeMillisAnonymous = Long.parseLong(getOptionalProperty(props, "maxCheckTimeMillisAnonymous", String.valueOf(maxCheckTimeMillisAnonymous)));
maxCheckTimeMillisLoggedIn = Long.parseLong(getOptionalProperty(props, "maxCheckTimeMillisLoggedIn", String.valueOf(maxCheckTimeMillisLoggedIn)));
maxCheckTimeMillisPremium = Long.parseLong(getOptionalProperty(props, "maxCheckTimeMillisPremium", String.valueOf(maxCheckTimeMillisPremium)));
requestLimit = Integer.parseInt(getOptionalProperty(props, "requestLimit", "0"));
requestLimitInBytes = Integer.parseInt(getOptionalProperty(props, "requestLimitInBytes", "0"));
timeoutRequestLimit = Integer.parseInt(getOptionalProperty(props, "timeoutRequestLimit", "0"));
requestLimitWhitelistUsers = Arrays.asList(getOptionalProperty(props, "requestLimitWhitelistUsers", "").split(",\\s*"));
requestLimitWhitelistLimit = Integer.parseInt(getOptionalProperty(props, "requestLimitWhitelistLimit", "0"));
pipelineCaching = Boolean.parseBoolean(getOptionalProperty(props, "pipelineCaching", "false").trim());
pipelinePrewarming = Boolean.parseBoolean(getOptionalProperty(props, "pipelinePrewarming", "false").trim());
maxPipelinePoolSize = Integer.parseInt(getOptionalProperty(props, "maxPipelinePoolSize", "5"));
pipelineExpireTime = Integer.parseInt(getOptionalProperty(props, "pipelineExpireTimeInSeconds", "10"));
requestLimitPeriodInSeconds = Integer.parseInt(getOptionalProperty(props, "requestLimitPeriodInSeconds", "0"));
ipFingerprintFactor = Integer.parseInt(getOptionalProperty(props, "ipFingerprintFactor", "1"));
trustXForwardForHeader = Boolean.valueOf(getOptionalProperty(props, "trustXForwardForHeader", "false").trim());
maxWorkQueueSize = Integer.parseInt(getOptionalProperty(props, "maxWorkQueueSize", "0"));
if (maxWorkQueueSize < 0) {
throw new IllegalArgumentException("maxWorkQueueSize must be >= 0: " + maxWorkQueueSize);
}
minPort = Integer.parseInt(getOptionalProperty(props, "minPort", "0"));
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);
}View on GitHub (pinned to 2e990059ce)
Solutions
- Set maxWorkQueueSize to 0 (unbounded) or a positive integer in the properties file
- Remove the property to fall back to the default (0)
- Double-check generated/templated config values for negative numbers
Example fix
# before (server.properties) maxWorkQueueSize=-1 # after maxWorkQueueSize=100
Defensive patterns
Strategy: validation
Validate before calling
// validate before handing props to the server
int v = Integer.parseInt(props.getProperty("maxWorkQueueSize", "0"));
if (v < 0) throw new IllegalArgumentException("maxWorkQueueSize must be >= 0, got " + v); Try / catch
try { cfg = new HTTPServerConfig(props, args); } catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("maxWorkQueueSize")) { props.setProperty("maxWorkQueueSize", "0"); cfg = new HTTPServerConfig(props, args); } else throw e;
} Prevention
- Schema-validate server.properties in CI (all numeric bounds)
- Avoid sign-prefixing generated numbers; clamp at write time
- Document that 0 means unbounded, not 'disabled'
When it happens
Trigger: Setting 'maxWorkQueueSize' to a negative integer (e.g. -1) in the properties file passed via --config.
Common situations: Hand-editing properties with sign errors; templating/config-generation bugs injecting negative values; misunderstanding that only >=0 is valid.
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:
- Invalid value for maxTextCheckerThreads, must be >= 1:
- 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/46c646e5bc0004b8.
Report an issue: GitHub.