languagetool-org/languagetool · error · RuntimeException
Invalid line in , expected 'RULE_ID,float_value[,...]':
Error message
Invalid line in , expected 'RULE_ID,float_value[,...]':
What it means
Confidence map lines must contain at least two columns ('RULE_ID,float_value[,...]'). If a non-empty line yields fewer than two tab-separated parts, load throws a RuntimeException naming the file and the line.
Source
Thrown at languagetool-server/src/main/java/org/languagetool/server/ConfidenceMapLoader.java:67
if (!Paths.get(fileName).toFile().exists()) {
continue;
}
List<String> lines = Files.readAllLines(Paths.get(fileName), UTF_8);
for (String line : lines) {
if (line.startsWith("#")) {
continue;
}
String[] parts = line.split(",");
if (parts.length >= 2) { // there might be more columns for better debugging, but we don't use them here
try {
float confidence = Float.parseFloat(parts[1]);
confMap.put(new ConfidenceKey(lang, parts[0]), confidence);
loadCount++;
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid confidence float value in " + fileName + ", expected 'RULE_ID,float_value[,...]': " + line);
}
} else {
throw new RuntimeException("Invalid line in " + fileName + ", expected 'RULE_ID,float_value[,...]': " + line);
}
}
logger.info("Loaded " + loadCount + " mappings for " + lang + " from confidence map for rules from " + fileName);
}
if (confMap.size() == 0) {
throw new RuntimeException("No confidence values could be loaded for " + filePattern +
" -- please check there are actually files that match this pattern");
}
return confMap;
}
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Give every line a second, tab-separated float column: 'RULE_ID<tab>0.8'.
- Check that fields are separated by tabs, not commas or spaces.
- Delete header, comment, or empty lines that do not match the format.
- Verify which file the message names and fix that language's file.
Example fix
// before MY_RULE // after MY_RULE 0.8
Defensive patterns
Strategy: validation
Validate before calling
for (const line of lines) {
if (line.split('\t').length < 2) throw new Error('Line needs RULE_ID and float value: ' + line);
} Type guard
function hasTwoColumns(line) { return line.split('\t').length >= 2; } Try / catch
try {
Map<ConfidenceKey,Float> map = new ConfidenceMapLoader().load(filePattern);
} catch (RuntimeException e) {
logger.error("Confidence map line invalid: " + e.getMessage());
} Prevention
- Generate files with tab separators, not CSV.
- Remove header or blank lines from confidence files.
- Add a format check script to the deployment pipeline.
When it happens
Trigger: A confidence file contains a line with only a rule ID ('MY_RULE'), a blank-ish line, or a line using the wrong separator (space/comma instead of tab) so no second column is found.
Common situations: Manually edited files missing the value column; exporting CSV instead of the tab-separated format the loader expects; trailing header lines left in the file.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid confidence float value in , expected 'RULE_ID,float_
- Could not load simple replacement data from: " + path + ". E
- Format error in file " + path + ", line: " + line
- id is null for rule with name '
- Format error in file " + path + ", line: " + line + ", " + "
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/8de569e818d22906.
Report an issue: GitHub.