NationalSecurityAgency/ghidra · error · IOException
Could not get MD5 on file:
Error message
Could not get MD5 on file:
What it means
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.
Source
Thrown at Ghidra/Features/BSim/other/testscripts/RegressionSignatures.java:41
import generic.lsh.vector.LSHVectorFactory;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.FunctionManager;
import ghidra.features.bsim.query.FunctionDatabase;
import ghidra.features.bsim.query.GenSignatures;
import ghidra.features.bsim.query.client.Configuration;
import ghidra.features.bsim.query.description.DescriptionManager;
/**
* This script is used by the unit test BSimServerTest
*/
public class RegressionSignatures extends GhidraScript {
@Override
protected void run() throws Exception {
String md5string = currentProgram.getExecutableMD5();
if ((md5string == null) || (md5string.length() < 10))
throw new IOException("Could not get MD5 on file: " + currentProgram.getName());
String basename = "sigs_" + md5string;
File file = null;
// This form of askString will work for both standalone execution or for parallel
File workingdir = askDirectory("RegressionSignatures:", "Working directory");
file = new File(workingdir, basename);
LSHVectorFactory vectorFactory = FunctionDatabase.generateLSHVectorFactory();
Configuration config = FunctionDatabase.loadConfigurationTemplate("medium_64");
vectorFactory.set(config.weightfactory, config.idflookup, config.info.settings);
GenSignatures gensig = new GenSignatures(true);
gensig.setVectorFactory(vectorFactory);
List<String> names = new ArrayList<String>();
names.add("Test Category");
gensig.addExecutableCategories(names);
String repo = "ghidra://localhost/repo";
String path = "/raw";
gensig.openProgram(this.currentProgram, null, null, null, repo, path);View on GitHub (pinned to d5f144c24d)
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.
Defensive patterns
Strategy: validation
Validate before calling
String md5 = currentProgram.getExecutableMD5();
if (md5 == null || md5.length() < 10) {
Assert.fail("Test fixture program '" + currentProgram.getName() +
"' has no MD5. Regenerate fixture via import + analysis.");
} Prevention
- 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.
When it happens
Trigger: Running RegressionSignatures.run() (invoked by BSimServerTest) where currentProgram.getExecutableMD5() returns null or length < 10. The test program fixture lacks MD5 metadata.
Common situations: 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.
Related errors
- Could not get MD5 on file:
- Could not get MD5 on file:
- Invalid MD5 hash string: {md5}
- ${e1.getMessage()}
- Unable to signature functions
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/90949b6a89f93009.
Report an issue: GitHub.