languagetool-org/languagetool · error · RuntimeException
Frequency out of range (0-255): ${normalizedFreq} in word ${
Error message
Frequency out of range (0-255): ${normalizedFreq} in word ${key} What it means
Sanity guard in DictionaryBuilder.addFreqData: after log normalization a word's frequency maps outside the byte range 0-255, indicating a broken frequency value or corrupted freq list.
Source
Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:178
String line;
int maxFreq = Collections.max(freqList.values());
double maxFreqLog = Math.log(maxFreq);
while ((line = br.readLine()) != null) {
Matcher m = pTaggerEntry.matcher(line);
if (m.matches()) {
int freq = 0;
String key = m.group(1);
if (freqList.containsKey(key)) {
freq = freqList.get(key);
freqValuesApplied++;
}
int normalizedFreq = freq;
if (freq > 0 && maxFreq > 255) {
double freqZeroToOne = Math.log(freq) / maxFreqLog; // spread number better over the range
normalizedFreq = (int) (freqZeroToOne * (FREQ_RANGES_IN-1)); // 0 to 255
}
if (normalizedFreq < 0 || normalizedFreq > 255) {
throw new RuntimeException("Frequency out of range (0-255): " + normalizedFreq + " in word " + key);
}
// Convert integers 0-255 to ranges A-Z, and write output
String freqChar = Character.toString((char) (FIRST_RANGE_CODE + normalizedFreq*FREQ_RANGES_OUT/FREQ_RANGES_IN));
//add separator only in speller dictionaries
if (useSeparator) {
bw.write(line + separator + freqChar + "\n");
} else {
bw.write(line + freqChar + "\n");
}
}
}
System.out.println(freqList.size() + " frequency values applied to " + freqValuesApplied + " word forms.");
} catch (IOException e) {
throw new RuntimeException("Cannot read file: " + dictFile.getAbsolutePath());
}
return tempFile;
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Check the frequency list for malformed or extreme entries
- Ensure the tagger list and frequency list cover consistent words
- Recompute the frequency list from a clean corpus
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:178 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/6280b2dbdb947933.
Report an issue: GitHub.