{"record":{"id":"9bea4ea5e32e2413","repo":"languagetool-org/languagetool","slug":"unknown-level-level-currently-only-picky","errorCode":null,"errorMessage":"Unknown level '<level>' - currently, only 'PICKY' is supported","messagePattern":"Unknown level '<level>' - currently, only 'PICKY' is supported","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-commandline/src/main/java/org/languagetool/commandline/CommandLineParser.java","lineNumber":61,"sourceCode":"        options.setPrintLanguages(true);\n      } else if (args[i].equals(\"-h\") || args[i].equals(\"-help\") || args[i].equals(\"--help\") || args[i].equals(\"--?\")) {\n        options.setPrintUsage(true);\n      } else if (args[i].equals(\"-adl\") || args[i].equals(\"--autoDetect\")) {    // set autoDetect flag\n        options.setAutoDetect(true);\n      } else if (args[i].equals(\"-v\") || args[i].equals(\"--verbose\")) {\n        options.setVerbose(true);\n      } else if (args[i].equals(\"--line-by-line\")) {\n        options.setLineByLine(true);\n      } else if (args[i].equals(\"--enable-temp-off\")) {\n        options.setEnableTempOff(true);\n      } else if (args[i].equals(\"--clean-overlapping\")) {\n        options.setCleanOverlapping(true);\n      } else if (args[i].equals(\"--level\")) {\n        String level = args[++i];\n        try {\n          options.setLevel(JLanguageTool.Level.valueOf(level));\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\"Unknown level '\" + level + \"' - currently, only 'PICKY' is supported\");\n        }\n      } else if (args[i].equals(\"-t\") || args[i].equals(\"--taggeronly\")) {\n        options.setTaggerOnly(true);\n        if (options.isListUnknown()) {\n          throw new IllegalArgumentException(\"You cannot list unknown words when tagging only\");\n        }\n        if (options.isApplySuggestions()) {\n          throw new IllegalArgumentException(\"You cannot apply suggestions when tagging only\");\n        }\n      } else if (args[i].equals(\"-r\") || args[i].equals(\"--recursive\")) {\n        options.setRecursive(true);\n      } else if (args[i].equals(\"-b2\") || args[i].equals(\"--bitext\")) {\n        options.setBitext(true);\n      } else if (args[i].equals(\"-eo\") || args[i].equals(\"--enabledonly\")) {\n        if (options.getDisabledRules().size() > 0) {\n          throw new IllegalArgumentException(\"You cannot specify both disabled rules and enabledonly\");\n        }\n        options.setUseEnabledOnly();","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-commandline/src/main/java/org/languagetool/commandline/CommandLineParser.java#L43-L79","documentation":"When parsing `--level`, parseOptions() tries JLanguageTool.Level.valueOf(level). If the value is not a defined Level enum constant, it rethrows IllegalArgumentException with this message, since the CLI currently only implements the PICKY level.","triggerScenarios":"`languagetool --level picky file.txt` (wrong case), `--level PICKYALL`, or any misspelled/unimplemented level name passed after --level.","commonSituations":"Copy-pasting level names from other tools or docs; assuming case-insensitivity; assuming more levels exist in the CLI than the enum (only PICKY is wired up).","solutions":["Use exactly `--level PICKY` (uppercase).","Omit --level entirely to use the default level.","Check the JLanguageTool.Level enum constants for the accepted values.","Wrap your own call to parseOptions/Main in a try-catch for IllegalArgumentException if you build commands dynamically."],"exampleFix":"// before\nlanguagetool --level picky file.txt\n// after\nlanguagetool --level PICKY file.txt","handlingStrategy":"validation","validationCode":"String level = System.getenv(\"LT_LEVEL\");\nif (level != null && !level.equals(\"PICKY\")) {\n  throw new IllegalArgumentException(\"--level must be exactly 'PICKY'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  new CommandLineParser().parseOptions(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unknown level\")) {\n    System.err.println(\"Use --level PICKY (uppercase); it is the only supported level.\");\n  }\n}","preventionTips":["Always write the level in uppercase: PICKY.","Check JLanguageTool.Level enum constants before passing a value.","Validate user-supplied level strings in wrapper scripts before invoking the CLI."],"tags":["cli","enum","invalid-value"],"backgroundTag":"invalid-enum-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"}