{"record":{"id":"46c646e5bc0004b8","repo":"languagetool-org/languagetool","slug":"maxworkqueuesize-must-be-0","errorCode":null,"errorMessage":"maxWorkQueueSize must be >= 0: ","messagePattern":"maxWorkQueueSize must be >= 0: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":343,"sourceCode":"        maxCheckTimeMillisAnonymous = maxCheckTimeMillisLoggedIn = maxCheckTimeMillisPremium = Integer.parseInt(getOptionalProperty(props, \"maxCheckTimeMillis\", \"-1\"));\n        maxCheckTimeMillisAnonymous = Long.parseLong(getOptionalProperty(props, \"maxCheckTimeMillisAnonymous\", String.valueOf(maxCheckTimeMillisAnonymous)));\n        maxCheckTimeMillisLoggedIn = Long.parseLong(getOptionalProperty(props, \"maxCheckTimeMillisLoggedIn\", String.valueOf(maxCheckTimeMillisLoggedIn)));\n        maxCheckTimeMillisPremium = Long.parseLong(getOptionalProperty(props, \"maxCheckTimeMillisPremium\", String.valueOf(maxCheckTimeMillisPremium)));\n        requestLimit = Integer.parseInt(getOptionalProperty(props, \"requestLimit\", \"0\"));\n        requestLimitInBytes = Integer.parseInt(getOptionalProperty(props, \"requestLimitInBytes\", \"0\"));\n        timeoutRequestLimit = Integer.parseInt(getOptionalProperty(props, \"timeoutRequestLimit\", \"0\"));\n        requestLimitWhitelistUsers = Arrays.asList(getOptionalProperty(props, \"requestLimitWhitelistUsers\", \"\").split(\",\\\\s*\"));\n        requestLimitWhitelistLimit = Integer.parseInt(getOptionalProperty(props, \"requestLimitWhitelistLimit\", \"0\"));\n        pipelineCaching = Boolean.parseBoolean(getOptionalProperty(props, \"pipelineCaching\", \"false\").trim());\n        pipelinePrewarming = Boolean.parseBoolean(getOptionalProperty(props, \"pipelinePrewarming\", \"false\").trim());\n        maxPipelinePoolSize = Integer.parseInt(getOptionalProperty(props, \"maxPipelinePoolSize\", \"5\"));\n        pipelineExpireTime = Integer.parseInt(getOptionalProperty(props, \"pipelineExpireTimeInSeconds\", \"10\"));\n        requestLimitPeriodInSeconds = Integer.parseInt(getOptionalProperty(props, \"requestLimitPeriodInSeconds\", \"0\"));\n        ipFingerprintFactor = Integer.parseInt(getOptionalProperty(props, \"ipFingerprintFactor\", \"1\"));\n        trustXForwardForHeader = Boolean.valueOf(getOptionalProperty(props, \"trustXForwardForHeader\", \"false\").trim());\n        maxWorkQueueSize = Integer.parseInt(getOptionalProperty(props, \"maxWorkQueueSize\", \"0\"));\n        if (maxWorkQueueSize < 0) {\n          throw new IllegalArgumentException(\"maxWorkQueueSize must be >= 0: \" + maxWorkQueueSize);\n        }\n        minPort = Integer.parseInt(getOptionalProperty(props, \"minPort\", \"0\"));\n        maxPort = Integer.parseInt(getOptionalProperty(props, \"maxPort\", \"0\"));\n        String url = getOptionalProperty(props, \"serverURL\", null);\n        setServerURL(url);\n        String ruleIdToConfidence = getOptionalProperty(props, \"ruleIdToConfidenceFile\", null);\n        if (ruleIdToConfidence != null) {\n          ruleIdToConfidenceFile = new File(ruleIdToConfidence);\n        }\n        String langModel = getOptionalProperty(props, \"languageModel\", null);\n        if (langModel != null && loadLangModel) {\n          setLanguageModelDirectory(langModel);\n        }\n        String fasttextModel = getOptionalProperty(props, \"fasttextModel\", null);\n        String fasttextBinary = getOptionalProperty(props, \"fasttextBinary\", null);\n        if (fasttextBinary != null && fasttextModel != null) {\n          setFasttextPaths(fasttextModel, fasttextBinary);\n        }","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L325-L361","documentation":"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.","triggerScenarios":"Setting 'maxWorkQueueSize' to a negative integer (e.g. -1) in the properties file passed via --config.","commonSituations":"Hand-editing properties with sign errors; templating/config-generation bugs injecting negative values; misunderstanding that only >=0 is valid.","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"],"exampleFix":"# before (server.properties)\nmaxWorkQueueSize=-1\n# after\nmaxWorkQueueSize=100","handlingStrategy":"validation","validationCode":"// validate before handing props to the server\nint v = Integer.parseInt(props.getProperty(\"maxWorkQueueSize\", \"0\"));\nif (v < 0) throw new IllegalArgumentException(\"maxWorkQueueSize must be >= 0, got \" + v);","typeGuard":null,"tryCatchPattern":"try { cfg = new HTTPServerConfig(props, args); } catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"maxWorkQueueSize\")) { props.setProperty(\"maxWorkQueueSize\", \"0\"); cfg = new HTTPServerConfig(props, args); } else throw e;\n}","preventionTips":["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'"],"tags":["configuration","validation","java","properties-file"],"backgroundTag":"invalid-config-value","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}