{"record":{"id":"0201aec91a0e218b","repo":"languagetool-org/languagetool","slug":"json-output-format-is-not-implemented-for-line-by","errorCode":null,"errorMessage":"JSON output format is not implemented for \"line by line\" analysis","messagePattern":"JSON output format is not implemented for \"line by line\" analysis","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-commandline/src/main/java/org/languagetool/commandline/CommandLineParser.java","lineNumber":142,"sourceCode":"        checkArguments(\"--bitextrules\", i, args);\n        options.setBitextRuleFile(args[++i]);\n      } else if (args[i].equals(\"-c\") || args[i].equals(\"--encoding\")) {\n        checkArguments(\"-c/--encoding\", i, args);\n        options.setEncoding(args[++i]);\n      } else if (args[i].equals(\"-u\") || args[i].equals(\"--list-unknown\")) {\n        options.setListUnknown(true);\n        if (options.isTaggerOnly()) {\n          throw new IllegalArgumentException(\"You cannot list unknown words when tagging only\");\n        }\n      } else if (args[i].equals(\"-b\")) {\n        options.setSingleLineBreakMarksParagraph(true);\n      } else if (args[i].equals(\"--json\")) {\n        options.setJsonFormat();\n        if (options.isApplySuggestions()) {\n          throw new IllegalArgumentException(\"JSON output format makes no sense for automatic application of suggestions\");\n        }\n        if (options.isLineByLine()) {\n          throw new IllegalArgumentException(\"JSON output format is not implemented for \\\"line by line\\\" analysis\");\n        }\n        if (options.isBitext()) {\n          throw new IllegalArgumentException(\"JSON output format is not implemented for Bitext\");\n        }\n        if (options.isListUnknown()) {\n          throw new IllegalArgumentException(\"You cannot list unknown words in JSON output format\");\n        }\n      } else if (args[i].equals(\"-a\") || args[i].equals(\"--apply\")) {\n        options.setApplySuggestions(true);\n        if (options.isTaggerOnly()) {\n          throw new IllegalArgumentException(\"You cannot apply suggestions when tagging only\");\n        }\n        if (options.isJsonFormat()) {\n          throw new IllegalArgumentException(\"JSON output format makes no sense for automatic application of suggestions\");\n        }\n      } else if (args[i].equals(\"-p\") || args[i].equals(\"--profile\")) {\n        options.setProfile(true);\n        if (options.isJsonFormat()) {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-commandline/src/main/java/org/languagetool/commandline/CommandLineParser.java#L124-L160","documentation":"`--line-by-line` analyzes each line as an independent text, while JSON output is designed for whole documents with offsets. Combining them is not implemented, so when --json is parsed and lineByLine was already set, parseOptions() throws this IllegalArgumentException.","triggerScenarios":"`languagetool --line-by-line --json file.txt` — --line-by-line parsed before --json.","commonSituations":"Users processing line-oriented formats (CSV lines, logs) who also want structured JSON; batch scripts converting earlier line-by-line invocations to JSON output.","solutions":["Remove --line-by-line and let JSON output cover the whole file.","Remove --json and use the default textual line-by-line output.","Split the file yourself and run --json per chunk, merging results in your script."],"exampleFix":"// before\nlanguagetool --line-by-line --json -l en file.txt\n// after\nlanguagetool --json -l en file.txt","handlingStrategy":"validation","validationCode":"List<String> a = Arrays.asList(args);\nif (a.contains(\"--json\") && (a.contains(\"--line-by-line\") || a.contains(\"-lbyl\"))) {\n  throw new IllegalArgumentException(\"--json is incompatible with line-by-line mode\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  new CommandLineParser().parseOptions(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"line by line\")) {\n    System.err.println(\"Drop --line-by-line or --json; they are not implemented together.\");\n  }\n}","preventionTips":["Use whole-document input when you need JSON output.","Handle line-oriented formats by splitting input in your own script and running --json per chunk.","Check release notes in case line-by-line JSON is implemented later."],"tags":["cli","conflicting-flags","json"],"backgroundTag":"mutually-exclusive-flags","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"}