{"record":{"id":"8f6396e319b61d27","repo":"NationalSecurityAgency/ghidra","slug":"could-not-prefetch-scores","errorCode":null,"errorMessage":"Could not prefetch scores: ","messagePattern":"Could not prefetch scores: ","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java","lineNumber":142,"sourceCode":"\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 {\n\t\ttry {\n\t\t\tloadCache();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new LSHException(\"Could not prefetch scores: \" + e.getMessage());\n\t\t}\n\t\tif (missing != null) {\n\t\t\tif (cacheMap == null) {\n\t\t\t\tfor (ExecutableRecord exeRec : exeSet) {\n\t\t\t\t\tmissing.add(exeRec);\t\t\t// Everything is missing\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (ExecutableRecord exeRec : exeSet) {\n\t\t\t\t\tif (!cacheMap.containsKey(exeRec.getMd5())) {\n\t\t\t\t\t\tmissing.add(exeRec);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java#L124-L160","documentation":"Thrown by FileScoreCaching.prefetchScores() wrapping any IOException from loadCache(). Prefetch loads the entire cache to check which executables in a set have scores; if the cache file is corrupt or unreadable the load fails and the prefetch cannot proceed.","triggerScenarios":"Calling prefetchScores(exeSet, missing) when the backing cache file is malformed, truncated, or unreadable. This is the entry point used by ExecutableScorerSingle.prefetchSelfScores() to bulk-load scores.","commonSituations":"Running a one-to-many comparison that calls prefetchSelfScores, but the cache file was left in a corrupt state by a previous failed run. Permissions or path issues preventing the file read.","solutions":["Regenerate the cache file via resetStorage or by deleting and re-running the scoring workflow.","Inspect the wrapped IOException message for the specific failure.","Verify the cache file path and permissions."],"exampleFix":"// before\nscorer.prefetchSelfScores(missing); // throws \"Could not prefetch scores\"\n\n// after — reset cache and retry\ncatch (LSHException e) {\n    cache.resetStorage(simThresh, sigThresh);\n    scorer.prefetchSelfScores(missing);\n}","handlingStrategy":"try-catch","validationCode":"File cacheFile = new File(cachePath);\nif (cacheFile.exists() && cacheFile.length() < 10) {\n    cacheFile.delete();\n}","typeGuard":null,"tryCatchPattern":"try {\n    scorer.prefetchSelfScores(missing);\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Could not prefetch\")) {\n        cache.resetStorage(simThresh, sigThresh);\n        scorer.prefetchSelfScores(missing);\n    } else throw e;\n}","preventionTips":["Validate cache integrity before prefetching.","Reset the cache on load failures and retry.","Log the wrapped IOException to diagnose the underlying file issue."],"tags":["bsim","ghidra","score-cache","io","prefetch"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}