{"record":{"id":"151aea7d25d159b8","repo":"languagetool-org/languagetool","slug":"format-error-in-file-path-line-line","errorCode":null,"errorMessage":"Format error in file ${path}, line: ${line}","messagePattern":"Format error in file (.+?), line: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/rules/AbstractRepeatedWordsRule.java","lineNumber":212,"sourceCode":"        String postag = null;\n        String chunk = null;\n        String word;\n        if (mainParts.length == 2) {\n          parts = mainParts[1].split(\";\");\n          word = mainParts[0];\n          String[] wordPosChunk = word.split(\"/\");\n          word = wordPosChunk[0];\n          if (wordPosChunk.length > 1) {\n            postag = wordPosChunk[1];\n          }\n          if (wordPosChunk.length > 2) {\n            chunk = wordPosChunk[2];\n          }\n        } else if (mainParts.length == 1) {\n          parts = line.split(\";\");\n          word = \"\";\n        } else {\n          throw new RuntimeException(\"Format error in file \" + path + \", line: \" + line);\n        }\n        if (word.isEmpty() && parts.length < 2 || !word.isEmpty() && parts.length < 1) {\n          throw new RuntimeException(\"Format error in file \" + path + \", line: \" + line);\n        }\n        if (!word.isEmpty()) {\n          if (!map.containsKey(word)) {\n            SynonymsData synonymsData = new SynonymsData(Arrays.asList(parts), postag, chunk);\n            map.put(word, synonymsData);\n          } else {\n            throw new RuntimeException(\"Word found in more than one line. \\\"\" + word + \"\\\" in line: \" + line);\n          }\n        } else {\n          for (String key : parts) {\n            List<String> values = new ArrayList<>();\n            for (String value : parts) {\n              if (!value.equals(key)) {\n                values.add(value);\n              }","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/rules/AbstractRepeatedWordsRule.java#L194-L230","documentation":"AbstractRepeatedWordsRule.loadWords parses a repeated-words data file line by line; each line must contain a word and at least one semicolon-separated attribute (or a word=... mapping plus ;parts). This RuntimeException is thrown when a line's structure doesn't match either expected format (e.g. more than one main part but no valid word, or too few ';'-separated parts).","triggerScenarios":"Calling loadWords on a data file containing a line that splits into mainParts of length 0 or >=2 while a word was already parsed, or a line that yields fewer parts than required (word empty with <2 parts, word non-empty with <1 part).","commonSituations":"Editing or translating a repeated-words rules file (e.g. spelling_xx.txt-style data) and inserting a malformed line; copying data files between language variants with divergent formats; stray punctuation or a missing semicolon in a hand-edited line.","solutions":["Open the file named in the message at the reported line and fix it to match the expected format (word;... with at least the required number of ';'-separated fields).","Validate every line has the expected separators before deploying the data file (e.g. a CI check that each non-comment line contains the required ';').","If the file came from another language variant or older LT version, regenerate it from a current template instead of hand-editing."],"exampleFix":"// before (malformed data line in the words file)\nwordwithnoparts\n// after\nwordwithnoparts;someattribute","handlingStrategy":"validation","validationCode":"for (String line : Files.readAllLines(Paths.get(path))) {\n  if (line.isEmpty() || line.startsWith(\"#\")) continue;\n  String[] mainParts = line.split(\"=\", 2);\n  String[] parts = mainParts[mainParts.length == 1 ? 0 : 1].split(\";\");\n  boolean wordEmpty = mainParts.length == 1;\n  if (wordEmpty ? parts.length < 2 : parts.length < 1) {\n    throw new IllegalStateException(\"Malformed repeated-words line: \" + line);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint custom LT data files in CI before shipping","Only edit repeated-words files with the exact expected separator scheme","Copy an existing valid file as template rather than starting from scratch"],"tags":["java","languagetool","data-file-format","rule-loading"],"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-14T05:17:10.506Z"}