{"record":{"id":"48d1112bca876b34","repo":"languagetool-org/languagetool","slug":"missing-argument-for-logipmatchingpattern-e-g","errorCode":null,"errorMessage":"Missing argument for '--logIpMatchingPattern' (e.g. any random String)","messagePattern":"Missing argument for '--logIpMatchingPattern' \\(e\\.g\\. any random String\\)","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":296,"sourceCode":"            }\n          } catch (ArrayIndexOutOfBoundsException e) {\n            allowOriginUrl = \"*\";\n          }\n          break;\n        case LANGUAGE_MODEL_OPTION:\n          setLanguageModelDirectory(args[++i]);\n          break;\n        case \"--stoppable\":  // internal only, doesn't need to be documented\n          stoppable = true;\n          break;\n        case \"--notLogIP\":\n          logIp = false;\n          break;\n        case \"--logIpMatchingPattern\":\n          try {\n            logIpMatchingPattern = args[++i];\n            if (logIpMatchingPattern.startsWith(\"--\")) {\n              throw new IllegalArgumentException(\"Missing argument for '--logIpMatchingPattern' (e.g. any random String)\");\n            }\n          } catch (ArrayIndexOutOfBoundsException e) {\n            throw new IllegalArgumentException(\"Missing argument for '--logIpMatchingPattern' (e.g. any random String)\");\n          }\n          break;\n        default:\n          if (args[i].contains(\"=\")) {\n            System.out.println(\"WARNING: unknown option: \" + args[i] +\n                    \" - please note that parameters are given as '--arg param', i.e. without '=' between argument and parameter\");\n          } else {\n            System.out.println(\"WARNING: unknown option: \" + args[i]);\n          }\n      }\n    }\n  }\n\n  private void parseConfigFile(File file, boolean loadLangModel) {\n    try {","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L278-L314","documentation":"The --logIpMatchingPattern option requires a value (a regex-like string). If the next argument is missing (ArrayIndexOutOfBoundsException) the constructor throws this IllegalArgumentException. This throw site covers the case where the flag is the last argument on the command line.","triggerScenarios":"Invoking the server with --logIpMatchingPattern as the final CLI argument so args[++i] throws ArrayIndexOutOfBoundsException.","commonSituations":"Truncated command lines in shell scripts or Dockerfiles; programmatically built arg arrays missing the trailing value; forgetting that parameters are separate space-delimited tokens.","solutions":["Append the pattern value after --logIpMatchingPattern on the command line","Check the launch script/Docker CMD for truncation or line-continuation mistakes","Pass a quoted string if the pattern contains special characters"],"exampleFix":"# before\njava ... HTTPServer --port 8081 --logIpMatchingPattern\n# after\njava ... HTTPServer --port 8081 --logIpMatchingPattern \"192\\\\.168\\\\..*\"","handlingStrategy":"validation","validationCode":"// verify every flag has its value before exec\nfor (int i = 0; i < args.length; i++) {\n  if (args[i].equals(\"--logIpMatchingPattern\") && (i + 1 >= args.length))\n    throw new IllegalArgumentException(\"--logIpMatchingPattern needs a value\");\n}","typeGuard":null,"tryCatchPattern":"try { cfg = new HTTPServerConfig(args); } catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"--logIpMatchingPattern\")) { abortWithUsage(); } else throw e;\n}","preventionTips":["Quote pattern values containing special characters in shell scripts","End Dockerfiles CMD/ENTRYPOINT arg arrays with the value, never a flag","Add a smoke test that starts the server with the exact production args"],"tags":["cli","missing-argument","java","configuration"],"backgroundTag":"missing-cli-argument","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}