NationalSecurityAgency/ghidra · error · LSHException
Could not commit self-score: {ex.getMessage()}
Error message
Could not commit self-score: {ex.getMessage()} What it means
Thrown by FileScoreCaching.commitSelfScore() wrapping any IOException that occurs while appending a score entry to the cache file. The write opens the file in append mode (FileWriter with append=true); if the I/O operation fails the exception is wrapped in an LSHException with the original message appended.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java:109
public void commitSelfScore(String md5, float score) throws LSHException {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(storageFile, true));
if (cacheMap == null) {
writer.write(Double.toString(simThreshold));
writer.newLine();
writer.write(Double.toString(sigThreshold));
writer.newLine();
cacheMap = new TreeMap<String, Float>();
}
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();View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the parent directory of the cache file exists and is writable by the process.
- Check the wrapped IOException message for the specific OS-level cause (permission denied, no space, etc.).
- Ensure no other process holds an exclusive lock on the cache file.
Example fix
// before — cache path parent dir does not exist
FileScoreCaching cache = new FileScoreCaching("/nonexistent/scores.txt");
cache.commitSelfScore(md5, 42.0f); // throws "Could not commit self-score: ..."
// after — ensure parent directory
File cacheFile = new File(cachePath);
cacheFile.getParentFile().mkdirs();
FileScoreCaching cache = new FileScoreCaching(cachePath);
cache.commitSelfScore(md5, 42.0f); Defensive patterns
Strategy: validation
Validate before calling
File cacheFile = new File(cachePath);
File parent = cacheFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
if (cacheFile.exists() && !cacheFile.canWrite()) {
throw new IllegalStateException("Cache file not writable: " + cachePath);
} Try / catch
try {
cache.commitSelfScore(md5, score);
} catch (LSHException e) {
if (e.getMessage().startsWith("Could not commit")) {
// check disk space, permissions, path validity
throw new RuntimeException("Cache write failed: " + e.getMessage(), e);
}
throw e;
} Prevention
- Ensure the cache file's parent directory exists and is writable.
- Check disk space before large ingest operations.
- Avoid pointing the cache path at a read-only location.
When it happens
Trigger: Calling commitSelfScore(md5, score) when the cache file path is not writable, the parent directory does not exist, the disk is full, the file is locked by another process, or the path points to a directory rather than a file.
Common situations: The cache file directory was never created. Permissions deny write access. A disk-full or quota-exceeded condition. The path resolves to a read-only filesystem or a location the JVM cannot open in append mode.
Related errors
- Could not recover cached scores: {e.getMessage()}
- Problems loading score cache: {e.getMessage()}
- Problems loading score cache:
- Could not prefetch scores:
- Score file missing threshold lines
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/952980255b2f4090.
Report an issue: GitHub.