{"record":{"id":"f9fd0d815c1c99a0","repo":"languagetool-org/languagetool","slug":"error-lines-from-the-input-file-should-contain-at","errorCode":null,"errorMessage":"Error: Lines from the input file should contain at least two tab-separated columns. Line: ${line}","messagePattern":"Error: Lines from the input file should contain at least two tab-separated columns\\. Line: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"languagetool-http-client/src/main/java/org/languagetool/remote/SentenceAnnotator.java","lineNumber":305,"sourceCode":"\n  /*\n   * If the input file has two tab-separated columns (original sentence, golden sentence),\n   * the sentence to be evaluated is generated by the API defined in the configuration.\n   *\n   * Otherwise, the input file has three tab-separated columns:\n   * original sentence, golden sentence, sentence to be evaluated (no API is used)\n   */\n  private static void runAutomaticAnnotation(AnnotatorConfig cfg) throws Exception {\n    DiffsAsMatches diffsAsMatches = new DiffsAsMatches();\n    List<String> lines = Files.readAllLines(Paths.get(cfg.inputFilePath));\n    int numSentence = 0;\n    System.out.println(\"Starting at line 1 of file \" + cfg.inputFilePath);\n    for (String line : lines) {\n      numSentence++;\n      line = line.replace(\"\\u00A0\" , \" \");\n      String[] parts = line.split(\"\\t\");\n      if (parts.length < 2) {\n        throw new Exception(\"Error: Lines from the input file should contain at least two tab-separated columns. \"\n          + \"Line: \" + line);\n      }\n      String sentence = parts[0].replace(\"__\", \"\");\n      String sentenceHash = md5FromSentence(sentence);\n      String correctedSentence = parts[1].replace(\"__\", \"\");\n      List<PseudoMatch> matchesGolden = diffsAsMatches.getPseudoMatches(sentence, correctedSentence);\n      if (parts.length < 3) {\n        List<RemoteRuleMatch> matches = getMatches(cfg, sentence);\n        correctedSentence = applyAllMatches(sentence, matches);\n      } else {\n        correctedSentence = parts[2].replace(\"__\", \"\");\n      }\n      RemoteRuleMatch match = null;\n      List<PseudoMatch> matchesEval = diffsAsMatches.getPseudoMatches(sentence, correctedSentence);\n      String errorType = \"\";\n      int iGolden = 0;\n      int iEval = 0;\n      while (iGolden < matchesGolden.size() || iEval < matchesEval.size()) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-http-client/src/main/java/org/languagetool/remote/SentenceAnnotator.java#L287-L323","documentation":"SentenceAnnotator.runAutomaticAnnotation reads an input file where each line must contain at least two tab-separated columns (sentence and corrected sentence). If splitting a line on tabs yields fewer than two parts, it throws this Exception naming the offending line. The message parameter is actually a hard-coded concatenation, so the dynamic line content is appended after the literal text.","triggerScenarios":"Feeding a TSV where some lines have only one column — blank lines, lines with spaces instead of tabs, header lines, or files exported with a different delimiter (CSV with commas).","commonSituations":"Hand-built annotation files with missing second column; spreadsheet export using semicolons/commas; trailing garbage or empty lines at EOF; copy-paste converting tabs to spaces.","solutions":["Open the file and fix the reported line so it has sentence<TAB>correction","Skip or sanitize blank/malformed lines before processing (filter lines containing '\\t')","Re-export the source data with tab delimiters, not commas or semicolons","Replace literal tab-equivalent markers (e.g. '__' placeholders handled by the tool) consistently in both columns"],"exampleFix":"// before: line \"This is a sentence\" (no tab)\n// after\n// This is a sentence\tThis is a corrected sentence\nlines.stream().filter(l -> l.contains(\"\\t\")).forEach(/* annotate */);","handlingStrategy":"validation","validationCode":"List<String> bad = Files.readAllLines(Path.of(cfg.inputFilePath)).stream()\n  .filter(l -> l.split(\"\\t\", -1).length < 2)\n  .collect(Collectors.toList());\nif (!bad.isEmpty()) throw new IllegalStateException(\"lines missing 2nd column: \" + bad);","typeGuard":"static boolean isValidTsvLine(String line) {\n  return line != null && line.split(\"\\t\", -1).length >= 2;\n}","tryCatchPattern":"try {\n  annotator.run();\n} catch (Exception e) {\n  if (e.getMessage().contains(\"at least two tab-separated columns\")) {\n    System.err.println(\"fix TSV: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Export annotation data strictly as TSV, never CSV with commas","Filter out blank lines before processing","Validate delimiter and column count with a preflight script"],"tags":["java","input-validation","tsv"],"backgroundTag":"invalid-argument-format","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"}