{"record":{"id":"3c73740fd3d29071","repo":"languagetool-org/languagetool","slug":"you-have-to-set-the-source-language-as-mother-ton","errorCode":null,"errorMessage":"You have to set the source language (as mother tongue) in bitext mode","messagePattern":"You have to set the source language \\(as mother tongue\\) in bitext mode","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java","lineNumber":455,"sourceCode":"    }\n    if (languageHint != null) {\n      String spellHint = \"\";\n      if (!prg.isSpellCheckingActive()) {\n        if (prg.lt.getLanguage().isVariant()) {\n          spellHint = \" (no spell checking active)\";\n        } else {\n          spellHint = \" (no spell checking active, specify a language variant like 'en-GB' if available)\";\n        }\n      }\n      System.err.println(languageHint + spellHint);\n    }\n    prg.setListUnknownWords(options.isListUnknown());\n    if (options.isProfile()) {\n      prg.setProfilingMode();\n    }\n    if (options.isBitext()) {\n      if (options.getMotherTongue() == null) {\n        throw new IllegalArgumentException(\"You have to set the source language (as mother tongue) in bitext mode\");\n      }\n      File bitextRuleFile = options.getBitextRuleFile() != null ? new File(options.getBitextRuleFile()) : null;\n      prg.setBitextMode(options.getMotherTongue(), options.getDisabledRules(), options.getEnabledRules(), bitextRuleFile);\n    }\n    if (options.isRecursive()) {\n      prg.runRecursive(options.getFilename(), options.getEncoding(), options.isXmlFiltering(), options.getLevel());\n    } else {\n      if (options.isLineByLine()) {\n        prg.runOnFileLineByLine(options.getFilename(), options.getEncoding(), options.getLevel());\n      } else {\n        prg.runOnFile(options.getFilename(), options.getEncoding(), options.isXmlFiltering());\n      }\n    }\n    prg.cleanUp();\n  }\n\n  private static void printLanguages() {\n    List<String> languages = new ArrayList<>();","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java#L437-L473","documentation":"In bitext (bilingual) mode LanguageTool needs the source language to align the two texts; it is taken from the --mother-tongue option. If --bitext is given without --mother-tongue, main() throws this IllegalArgumentException before any checking starts.","triggerScenarios":"Running the CLI with --bitext (bitext rule file mode) but omitting --mother-tongue <lang>.","commonSituations":"New users assuming the target language (-l) suffices for bitext checking; scripts migrated from plain mode to bitext mode without adding the source-language flag.","solutions":["Add --mother-tongue <sourceLanguageCode> alongside --bitext.","Ensure the source language code is a supported Language (e.g. en-US, de-DE).","If you do not actually want bitext checking, drop the --bitext flag."],"exampleFix":"// before\nlanguagetool -l de-DE --bitext --bitextrules rules.xml pair.txt\n// after\nlanguagetool -l de-DE --mother-tongue en-US --bitext --bitextrules rules.xml pair.txt","handlingStrategy":"validation","validationCode":"if (options.isBitext() && options.getMotherTongue() == null) {\n  throw new IllegalArgumentException(\"--mother-tongue is required with --bitext\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  prg.setBitextMode(motherTongue, disabled, enabled, bitextRuleFile);\n} catch (IllegalArgumentException e) {\n  printUsageAndExit(\"bitext mode requires --mother-tongue\");\n}","preventionTips":["Always pass --mother-tongue when using --bitext.","Add a CLI preflight that checks required flag combinations.","Document bitext requirements in wrapper scripts."],"tags":["cli","bitext","missing-argument","illegal-argument"],"backgroundTag":"missing-required-argument","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"}