languagetool-org/languagetool · error
Expected semicolon-separated input:
Error message
Expected semicolon-separated input:
What it means
AutomaticProhibitedCompoundRuleEvaluator.run() reads input lines that must contain exactly two semicolon-separated fields (a compound pair). Lines with comments (#) are skipped, but any remaining line whose split on ";\s*" does not yield exactly 2 parts triggers this IOException, because pairwise comparison of the compound variants is impossible.
Source
Thrown at languagetool-dev/src/main/java/org/languagetool/dev/bigdata/AutomaticProhibitedCompoundRuleEvaluator.java:82
DirectoryReader reader = DirectoryReader.open(FSDirectory.open(luceneIndexDir.toPath()));
searcher = new IndexSearcher(reader);
InputStream confusionSetStream = JLanguageTool.getDataBroker().getFromResourceDirAsStream("/" + LANGUAGE + "/confusion_sets.txt");
knownSets = new ConfusionSetLoader(language).loadConfusionPairs(confusionSetStream);
}
private void run(List<String> lines, File indexDir) throws IOException {
LanguageModel lm = new LuceneLanguageModel(indexDir);
ProhibitedCompoundRuleEvaluator evaluator = new ProhibitedCompoundRuleEvaluator(language, lm);
int lineCount = 0;
for (String line : lines) {
lineCount++;
if (line.contains("#")) {
System.out.println("Ignoring: " + line);
continue;
}
String[] parts = line.split(";\\s*");
if (parts.length != 2) {
throw new IOException("Expected semicolon-separated input: " + line);
}
try {
int i = 1;
for (String part : parts) {
// compare pair-wise - maybe we should compare every item with every other item?
if (i < parts.length) {
runOnPair(evaluator, line, lineCount, lines.size(), removeComment(part), removeComment(parts[i]));
}
i++;
}
} catch (RuntimeException e) {
e.printStackTrace();
}
}
System.out.println("Done. Ignored items because they are already known: " + ignored);
}
private String removeComment(String str) {View on GitHub (pinned to 2e990059ce)
Solutions
- Inspect the offending line printed in the message and correct it to exactly two semicolon-separated fields: word1;word2.
- Trim the line and skip blank lines before splitting.
- Handle comment lines robustly (skip lines starting with # or strip trailing comments) so partial comments don't corrupt the field count.
- Make the parser tolerant: allow >=2 parts, or log-and-continue on malformed lines.
Example fix
// before
String[] parts = line.split(";\\s*");
if (parts.length != 2) {
throw new IOException("Expected semicolon-separated input: " + line);
}
// after
String trimmed = line.trim();
if (trimmed.isEmpty() || trimmed.startsWith("#")) continue;
String[] parts = trimmed.split(";\\s*");
if (parts.length != 2) {
System.err.println("WARN: skipping malformed line: " + line);
continue;
} Defensive patterns
Strategy: validation
Validate before calling
String trimmed = line == null ? "" : line.trim();
boolean valid = !trimmed.isEmpty() && !trimmed.startsWith("#")
&& trimmed.split(";\\s*").length == 2;
if (!valid) throw new IllegalArgumentException("Bad compound pair line: " + line); Try / catch
try {
evaluator.run(inputPath);
} catch (IOException e) {
if (e.getMessage().startsWith("Expected semicolon-separated input")) {
System.err.println("Fix line format (word1;word2): " + e.getMessage());
}
} Prevention
- Keep compound pair files strictly as 'word1;word2' per line, no comments mid-line
- Trim and skip blank lines before parsing
- Only treat lines starting with '#' as comments
- Add a pre-flight lint that reports all malformed line numbers at once
When it happens
Trigger: An input line that isn't of the form 'word1;word2' — e.g. a single value with no semicolon, three or more semicolon-separated values, an empty or whitespace-only line slipping through, or a line whose '#' comment appears not at start so it isn't filtered by the contains("#") check but changes field count expectations.
Common situations: Hand-edited compound lists with stray semicolons; CSV exported with commas instead of semicolons; trailing semicolons producing an empty third part; pasting lines with embedded comments or extra columns.
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
- Format error in file " + path + ", line: " + line
- Cannot load or parse input stream of '${filename}'
- No ngram data found for:
- Error: Lines from the input file should contain at least two
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/31853dfcfe189046.
Report an issue: GitHub.