{"record":{"id":"685562be2a92070b","repo":"languagetool-org/languagetool","slug":"format-error-in-file-path-line-line-685562","errorCode":null,"errorMessage":"Format error in file \" + path + \", line: \" + line + \", \" + \"expected 3 semicolon-separated parts, got \" + parts.length","messagePattern":"Format error in file \" \\+ path \\+ \", line: \" \\+ line \\+ \", \" \\+ \"expected 3 semicolon-separated parts, got \" \\+ parts\\.length","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/es/src/main/java/org/languagetool/rules/es/ConfusionPairsDataLoader.java","lineNumber":49,"sourceCode":" * Load data for {@link AccentuationCheckRule}.\n * @since 3.3\n */\nclass ConfusionPairsDataLoader {\n\n  private static final String FILE_ENCODING = \"utf-8\";\n\n  Map<String, AnalyzedTokenReadings> loadWords(String path) {\n    final Map<String, AnalyzedTokenReadings> map = new HashMap<>();\n    final InputStream inputStream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path);\n    try (Scanner scanner = new Scanner(inputStream, FILE_ENCODING)) {\n      while (scanner.hasNextLine()) {\n        final String line = scanner.nextLine().trim();\n        if (line.isEmpty() || line.charAt(0) == '#') {  // ignore comments\n          continue;\n        }\n        final String[] parts = line.split(\";\");\n        if (parts.length != 3) {\n          throw new RuntimeException(\"Format error in file \" + path + \", line: \"\n                  + line + \", \" + \"expected 3 semicolon-separated parts, got \"\n                  + parts.length);\n        }\n        final AnalyzedToken analyzedToken = new AnalyzedToken(parts[1], parts[2], null);\n        if (!map.containsKey(parts[0])) {\n          map.put(parts[0], new AnalyzedTokenReadings(analyzedToken, 0));\n        } else {\n          AnalyzedTokenReadings atrs = map.get(parts[0]);\n          atrs.addReading(analyzedToken, \"\");\n          map.replace(parts[0], atrs);\n        }\n      }\n    }\n    return map;\n  }\n  \n}\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/es/src/main/java/org/languagetool/rules/es/ConfusionPairsDataLoader.java#L31-L67","documentation":"ConfusionPairsDataLoader.loadWords parses a data file line by line and expects each non-comment line to have exactly 3 semicolon-separated parts (word, form, tag). A malformed line produces a RuntimeException naming the file, line, actual and expected part counts.","triggerScenarios":"loadWords → loadFromPath reads a confusion-pairs data file (e.g. Spanish confusion_pairs.txt) and a non-empty, non-# line splits on ';' into other than 3 fields.","commonSituations":"Hand-editing the data file and adding/removing a semicolon; a line containing a trailing semicolon (4 parts) or only 2 fields; using semicolons inside the tag or word field.","solutions":["Open the file named in the message at the reported line and make it have exactly 3 semicolon-separated fields.","Remove extra semicolons (including trailing ones) or add missing fields.","Keep the word/tag fields free of ';' characters; escape or rephrase such content."],"exampleFix":"// before (confusion_pairs.txt, 4 parts)\nbien;bian;VMIC0000;;comment\n// after\nbem;vien;VMIC0000","handlingStrategy":"validation","validationCode":"String[] parts = line.split(\";\");\nif (parts.length != 3) {\n  throw new IllegalArgumentException(\"Skipping malformed data line \" + lineNo + \": expected 3 ';'-separated parts, got \" + parts.length);\n}","typeGuard":null,"tryCatchPattern":"try {\n  loader.loadWords(path, map);\n} catch (RuntimeException e) {\n  LOG.error(\"Malformed confusion-pairs data file: {}\", e.getMessage());\n}","preventionTips":["Validate data files with a linter/script before committing","Never place ';' inside word or tag fields","Check for accidental trailing semicolons on data lines"],"tags":["java","languagetool","data-file","parsing"],"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"}