{"record":{"id":"90949b6a89f93009","repo":"NationalSecurityAgency/ghidra","slug":"could-not-get-md5-on-file-90949b","errorCode":null,"errorMessage":"Could not get MD5 on file: ","messagePattern":"Could not get MD5 on file: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/other/testscripts/RegressionSignatures.java","lineNumber":41,"sourceCode":"import generic.lsh.vector.LSHVectorFactory;\nimport ghidra.app.script.GhidraScript;\nimport ghidra.program.model.listing.Function;\nimport ghidra.program.model.listing.FunctionManager;\nimport ghidra.features.bsim.query.FunctionDatabase;\nimport ghidra.features.bsim.query.GenSignatures;\nimport ghidra.features.bsim.query.client.Configuration;\nimport ghidra.features.bsim.query.description.DescriptionManager;\n\n/**\n * This script is used by the unit test BSimServerTest\n */\npublic class RegressionSignatures extends GhidraScript {\n\n\t@Override\n\tprotected void run() throws Exception {\n\t\tString md5string = currentProgram.getExecutableMD5();\n\t\tif ((md5string == null) || (md5string.length() < 10))\n\t\t\tthrow new IOException(\"Could not get MD5 on file: \" + currentProgram.getName());\n\t\tString basename = \"sigs_\" + md5string;\n\t\tFile file = null;\n\t\t// This form of askString will work for both standalone execution or for parallel\n\t\tFile workingdir = askDirectory(\"RegressionSignatures:\", \"Working directory\");\n\t\tfile = new File(workingdir, basename);\n\n\t\tLSHVectorFactory vectorFactory = FunctionDatabase.generateLSHVectorFactory();\n\t\tConfiguration config = FunctionDatabase.loadConfigurationTemplate(\"medium_64\");\n\t\tvectorFactory.set(config.weightfactory, config.idflookup, config.info.settings);\n\t\tGenSignatures gensig = new GenSignatures(true);\n\t\tgensig.setVectorFactory(vectorFactory);\n\n\t\tList<String> names = new ArrayList<String>();\n\t\tnames.add(\"Test Category\");\n\t\tgensig.addExecutableCategories(names);\n\t\tString repo = \"ghidra://localhost/repo\";\n\t\tString path = \"/raw\";\n\t\tgensig.openProgram(this.currentProgram, null, null, null, repo, path);","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/other/testscripts/RegressionSignatures.java#L23-L59","documentation":"RegressionSignatures, used by the BSimServerTest unit test, performs the same MD5 check as GenerateSignatures. If the current program's MD5 is null or too short it throws IOException. This is a test-helper script, so the error typically indicates a test fixture problem rather than a user action.","triggerScenarios":"Running RegressionSignatures.run() (invoked by BSimServerTest) where currentProgram.getExecutableMD5() returns null or length < 10. The test program fixture lacks MD5 metadata.","commonSituations":"The test fixture program was regenerated without analysis; the unit test's sample binary was replaced with one that lacks hash metadata; a test environment change (different Ghidra version) altered how MD5 is stored; the test program import step was skipped or failed silently.","solutions":["Regenerate the test fixture program by importing the sample binary and running full analysis so the MD5 is stored.","Verify the BSimServerTest setup steps (import/analysis) execute before this script runs.","Check that the test's sample binary file still exists and is readable.","If the fixture is committed, re-commit it after a clean import+analysis cycle."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"String md5 = currentProgram.getExecutableMD5();\nif (md5 == null || md5.length() < 10) {\n    Assert.fail(\"Test fixture program '\" + currentProgram.getName() +\n        \"' has no MD5. Regenerate fixture via import + analysis.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate test fixture programs after every Ghidra version upgrade.","Include an import+analysis step in the test setup to guarantee MD5 presence.","Add a pre-condition assert in the test to fail fast with a clear message.","Commit fixture programs only after a verified clean import+analysis cycle."],"tags":["bsim","signatures","md5","unit-test","test-fixture"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}