{"record":{"id":"7ea3e524897a7da0","repo":"NationalSecurityAgency/ghidra","slug":"problems-loading-score-cache-e-getmessage","errorCode":null,"errorMessage":"Problems loading score cache: {e.getMessage()}","messagePattern":"Problems loading score cache: (.+?)","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java","lineNumber":119,"sourceCode":"\t\t\tcacheMap.put(md5, score);\n\t\t\twriter.write(md5);\n\t\t\twriter.append(' ');\n\t\t\twriter.write(Float.toString(score));\n\t\t\twriter.newLine();\n\t\t\twriter.close();\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new LSHException(\"Could not commit self-score: \" + ex.getMessage());\n\t\t}\n\t}\n\n\t@Override\n\tpublic double getSimThreshold() throws LSHException {\n\t\ttry {\n\t\t\tloadCache();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new LSHException(\"Problems loading score cache: \" + e.getMessage());\n\t\t}\n\t\treturn simThreshold;\n\t}\n\n\t@Override\n\tpublic double getSigThreshold() throws LSHException {\n\t\ttry {\n\t\t\tloadCache();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new LSHException(\"Problems loading score cache: \" + e.getMessage());\n\t\t}\n\t\treturn sigThreshold;\n\t}\n\n\t@Override\n\tpublic void prefetchScores(Set<ExecutableRecord> exeSet, List<ExecutableRecord> missing)\n\t\t\tthrows LSHException {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java#L101-L137","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped IOException message for the specific cache-load failure.","Delete or resetStorage the corrupt cache file to regenerate it.","If this fires at ExecutableScorerSingle construction, fix the cache file before constructing the scorer."],"exampleFix":"// before\nFileScoreCaching cache = new FileScoreCaching(corruptPath);\ndouble sim = cache.getSimThreshold(); // throws\n\n// after — reset cache before use if corrupt\ntry {\n    double sim = cache.getSimThreshold();\n} catch (LSHException e) {\n    cache.resetStorage(defaultSimThresh, defaultSigThresh);\n    double sim = cache.getSimThreshold();\n}","handlingStrategy":"try-catch","validationCode":"File cacheFile = new File(cachePath);\nif (cacheFile.exists() && cacheFile.length() < 10) {\n    cacheFile.delete(); // likely corrupt\n}","typeGuard":null,"tryCatchPattern":"try {\n    double sim = cache.getSimThreshold();\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Problems loading\")) {\n        cache.resetStorage(defaultSimThresh, defaultSigThresh);\n        double sim = cache.getSimThreshold();\n    } else throw e;\n}","preventionTips":["Validate the cache file before constructing an ExecutableScorerSingle that reads thresholds.","Reset the cache on load failures rather than leaving it corrupt.","Log the wrapped IOException to diagnose the parse failure."],"tags":["bsim","ghidra","score-cache","io","threshold"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}