NationalSecurityAgency/ghidra · error · LSHException

Problems loading score cache: {e.getMessage()}

Error message

Problems loading score cache: {e.getMessage()}

What it means

Thrown by FileScoreCaching.getSimThreshold() wrapping any IOException from loadCache(). This method loads the cache to obtain the configured similarity threshold; if the cache file is corrupt, truncated, or unreadable the load fails and is re-thrown as an LSHException.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java:119

			cacheMap.put(md5, score);
			writer.write(md5);
			writer.append(' ');
			writer.write(Float.toString(score));
			writer.newLine();
			writer.close();
		}
		catch (IOException ex) {
			throw new LSHException("Could not commit self-score: " + ex.getMessage());
		}
	}

	@Override
	public double getSimThreshold() throws LSHException {
		try {
			loadCache();
		}
		catch (IOException e) {
			throw new LSHException("Problems loading score cache: " + e.getMessage());
		}
		return simThreshold;
	}

	@Override
	public double getSigThreshold() throws LSHException {
		try {
			loadCache();
		}
		catch (IOException e) {
			throw new LSHException("Problems loading score cache: " + e.getMessage());
		}
		return sigThreshold;
	}

	@Override
	public void prefetchScores(Set<ExecutableRecord> exeSet, List<ExecutableRecord> missing)
			throws LSHException {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Inspect the wrapped IOException message for the specific cache-load failure.
  2. Delete or resetStorage the corrupt cache file to regenerate it.
  3. If this fires at ExecutableScorerSingle construction, fix the cache file before constructing the scorer.

Example fix

// before
FileScoreCaching cache = new FileScoreCaching(corruptPath);
double sim = cache.getSimThreshold(); // throws

// after — reset cache before use if corrupt
try {
    double sim = cache.getSimThreshold();
} catch (LSHException e) {
    cache.resetStorage(defaultSimThresh, defaultSigThresh);
    double sim = cache.getSimThreshold();
}
Defensive patterns

Strategy: try-catch

Validate before calling

File cacheFile = new File(cachePath);
if (cacheFile.exists() && cacheFile.length() < 10) {
    cacheFile.delete(); // likely corrupt
}

Try / catch

try {
    double sim = cache.getSimThreshold();
} catch (LSHException e) {
    if (e.getMessage().startsWith("Problems loading")) {
        cache.resetStorage(defaultSimThresh, defaultSigThresh);
        double sim = cache.getSimThreshold();
    } else throw e;
}

Prevention

When it happens

Trigger: Calling getSimThreshold() when the cache file exists but is malformed (missing header lines, bad data lines) or unreadable. This commonly fires during ExecutableScorerSingle construction, which calls scoreCache.getSimThreshold() in its constructor.

Common situations: Constructing an ExecutableScorerSingle with a FileScoreCaching whose backing file is corrupt. A previous run crashed mid-write leaving a partial file. The cache file was manually edited or moved.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/7ea3e524897a7da0. Report an issue: GitHub.