languagetool-org/languagetool · error · RuntimeException
Format error in file ${path}, line: ${line}
Error message
Format error in file ${path}, line: ${line} What it means
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).
Source
Thrown at languagetool-core/src/main/java/org/languagetool/rules/AbstractRepeatedWordsRule.java:212
String postag = null;
String chunk = null;
String word;
if (mainParts.length == 2) {
parts = mainParts[1].split(";");
word = mainParts[0];
String[] wordPosChunk = word.split("/");
word = wordPosChunk[0];
if (wordPosChunk.length > 1) {
postag = wordPosChunk[1];
}
if (wordPosChunk.length > 2) {
chunk = wordPosChunk[2];
}
} else if (mainParts.length == 1) {
parts = line.split(";");
word = "";
} else {
throw new RuntimeException("Format error in file " + path + ", line: " + line);
}
if (word.isEmpty() && parts.length < 2 || !word.isEmpty() && parts.length < 1) {
throw new RuntimeException("Format error in file " + path + ", line: " + line);
}
if (!word.isEmpty()) {
if (!map.containsKey(word)) {
SynonymsData synonymsData = new SynonymsData(Arrays.asList(parts), postag, chunk);
map.put(word, synonymsData);
} else {
throw new RuntimeException("Word found in more than one line. \"" + word + "\" in line: " + line);
}
} else {
for (String key : parts) {
List<String> values = new ArrayList<>();
for (String value : parts) {
if (!value.equals(key)) {
values.add(value);
}View on GitHub (pinned to 2e990059ce)
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.
Example fix
// before (malformed data line in the words file) wordwithnoparts // after wordwithnoparts;someattribute
Defensive patterns
Strategy: validation
Validate before calling
for (String line : Files.readAllLines(Paths.get(path))) {
if (line.isEmpty() || line.startsWith("#")) continue;
String[] mainParts = line.split("=", 2);
String[] parts = mainParts[mainParts.length == 1 ? 0 : 1].split(";");
boolean wordEmpty = mainParts.length == 1;
if (wordEmpty ? parts.length < 2 : parts.length < 1) {
throw new IllegalStateException("Malformed repeated-words line: " + line);
}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Could not load simple replacement data from: " + path + ". E
- No IssueType found for name '" + name + "'. Valid values: "
- The number of forms and postags has to be the same in disamb
- Set 'no', 'regexp' and 'postag_regexp' for filter PartialPos
- Got " + matcher.groupCount() + " groups for regex '" + patte
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/151aea7d25d159b8.
Report an issue: GitHub.