{"record":{"id":"ec4afdc8e5b94d5c","repo":"NationalSecurityAgency/ghidra","slug":"self-score-not-recorded-for-md5","errorCode":null,"errorMessage":"Self-score not recorded for {md5}","messagePattern":"Self-score not recorded for (.+?)","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java","lineNumber":87,"sourceCode":"\t\t}\n\t\treader.close();\n\t}\n\n\t@Override\n\tpublic float getSelfScore(String md5) throws LSHException {\n\t\ttry {\n\t\t\tloadCache();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new LSHException(\"Could not recover cached scores: \" + e.getMessage());\n\t\t}\n\t\tif (cacheMap != null) {\n\t\t\tFloat val = cacheMap.get(md5);\n\t\t\tif (val != null) {\n\t\t\t\treturn val.floatValue();\n\t\t\t}\n\t\t}\n\t\tthrow new LSHException(\"Self-score not recorded for \" + md5);\n\t}\n\n\t@Override\n\tpublic void commitSelfScore(String md5, float score) throws LSHException {\n\t\ttry {\n\t\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(storageFile, true));\n\t\t\tif (cacheMap == null) {\n\t\t\t\twriter.write(Double.toString(simThreshold));\n\t\t\t\twriter.newLine();\n\t\t\t\twriter.write(Double.toString(sigThreshold));\n\t\t\t\twriter.newLine();\n\t\t\t\tcacheMap = new TreeMap<String, Float>();\n\t\t\t}\n\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();","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/FileScoreCaching.java#L69-L105","documentation":"Thrown by FileScoreCaching.getSelfScore() when the cache loads successfully (or the file does not exist, leaving cacheMap null) but the requested md5 is not present in the cache map. This means the executable's self-significance score was never committed, or no cache file exists at all.","triggerScenarios":"Calling getSelfScore(md5) for an executable whose self-score has not yet been computed and committed. Also thrown when the cache file does not exist (cacheMap stays null after loadCache returns early), making every lookup fail.","commonSituations":"Querying an executable that was never ingested/scored against this database. Using a fresh (non-existent) cache file before any commitSelfScore has been called. An md5 mismatch between the score key and the executable record.","solutions":["Ensure the executable's self-score has been committed via commitSelfScore(md5, score) before querying it.","Use prefetchScores(exeSet, missing) to batch-load scores and identify which executables are missing in one call.","Verify the md5 string is the correct 32-character hash of the target executable."],"exampleFix":"// before\nfloat score = cache.getSelfScore(md5); // throws if not yet committed\n\n// after — check and commit if missing\nList<ExecutableRecord> missing = new ArrayList<>();\ncache.prefetchScores(exeSet, missing);\nif (missing.contains(exeRec)) {\n    cache.commitSelfScore(exeRec.getMd5(), computedScore);\n}\nfloat score = cache.getSelfScore(md5);","handlingStrategy":"validation","validationCode":"// Check if the score exists before fetching\nList<ExecutableRecord> missing = new ArrayList<>();\ncache.prefetchScores(exeSet, missing);\nboolean hasScore = !missing.contains(exeRec);","typeGuard":null,"tryCatchPattern":"try {\n    return cache.getSelfScore(md5);\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Self-score not recorded\")) {\n        // compute and commit the score first\n        cache.commitSelfScore(md5, computedScore);\n        return computedScore;\n    }\n    throw e;\n}","preventionTips":["Use prefetchScores with the missing list to discover gaps before querying.","Commit a self-score before attempting to read it.","Verify the md5 is a valid 32-character hash of a registered executable."],"tags":["bsim","ghidra","score-cache","data-missing","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}