NationalSecurityAgency/ghidra · error · IOException
Bad line in score file
Error message
Bad line in score file
What it means
Thrown by FileScoreCaching.loadCache() when a score entry line (after the two threshold headers) does not conform to the expected format: exactly two space-separated tokens where the first token is a 32-character md5 string and the second is a float. Any line failing split.length != 2 or split[0].length() != 32 triggers this.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java:64
BufferedReader reader = new BufferedReader(new FileReader(storageFile));
String floatString = reader.readLine();
if (floatString == null) {
reader.close();
throw new IOException("Score file missing threshold lines");
}
simThreshold = Float.parseFloat(floatString);
floatString = reader.readLine();
if (floatString == null) {
reader.close();
throw new IOException("Score file missing threshold lines");
}
sigThreshold = Float.parseFloat(floatString);
floatString = reader.readLine();
while (floatString != null) {
String[] split = floatString.split(" ");
if (split.length != 2 || split[0].length() != 32) {
reader.close();
throw new IOException("Bad line in score file");
}
float val = Float.parseFloat(split[1]);
cacheMap.put(split[0], val);
floatString = reader.readLine();
}
reader.close();
}
@Override
public float getSelfScore(String md5) throws LSHException {
try {
loadCache();
}
catch (IOException e) {
throw new LSHException("Could not recover cached scores: " + e.getMessage());
}
if (cacheMap != null) {
Float val = cacheMap.get(md5);View on GitHub (pinned to d5f144c24d)
Solutions
- Delete the cache file and regenerate it by running the scoring workflow that commits self-scores.
- Call resetStorage(simThresh, sigThresh) to wipe and reinitialize.
- If you must repair, verify each data line is "<32-char-md5> <float>" with a single space separator and LF line endings.
Example fix
// before — cache file has a bad line: "abc123 0.75" (md5 too short) FileScoreCaching cache = new FileScoreCaching(path); cache.getSelfScore(md5); // throws "Bad line in score file" // after new File(path).delete(); // or cache.resetStorage(simThresh, sigThresh) // re-run the ingest that populates self-scores
Defensive patterns
Strategy: validation
Validate before calling
File cacheFile = new File(cachePath);
if (cacheFile.exists()) {
try (BufferedReader r = new BufferedReader(new FileReader(cacheFile))) {
r.readLine(); r.readLine(); // skip thresholds
String line;
while ((line = r.readLine()) != null) {
String[] parts = line.split(" ");
if (parts.length != 2 || parts[0].length() != 32) {
cacheFile.delete(); // malformed
break;
}
}
}
} Try / catch
try {
cache.getSelfScore(md5);
} catch (LSHException e) {
if (e.getMessage().contains("Bad line")) {
cache.resetStorage(simThresh, sigThresh);
} else throw e;
} Prevention
- Never hand-edit the score cache file; let the library manage it.
- Validate each data line format if you must inspect the file.
- Regenerate the cache from scratch when format errors appear.
When it happens
Trigger: Loading a cache file where a data line is malformed — e.g. a tab instead of a space delimiter, a truncated md5, extra whitespace producing more than 2 split tokens, a non-numeric score value, or a blank line in the middle of the data section.
Common situations: The cache file was hand-edited or generated by a different tool. A filesystem encoding issue or line-ending mismatch (CRLF vs LF) corrupted the split. An older BSim version wrote a different format that is now incompatible.
Related errors
- Score file missing threshold lines
- Could not recover cached scores: {e.getMessage()}
- Self-score not recorded for {md5}
- Could not commit self-score: {ex.getMessage()}
- Problems loading score cache: {e.getMessage()}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/19cce746311942f0.
Report an issue: GitHub.