NationalSecurityAgency/ghidra · error · IOException
{resultFolder.getAbsolutePath()} is not a valid directory
Error message
{resultFolder.getAbsolutePath()} is not a valid directory What it means
Thrown by doDumpSigs when resultFolder.isDirectory() returns false. This means the path either does not exist or exists but is a regular file rather than a directory. Signature files will be written into this folder, so it must be a valid writable directory.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java:985
query.spec.exemd5 = md5;
query.spec.exename = name;
query.spec.arch = null;
query.spec.execompname = null;
doDumpSigs(resultFolder, query);
}
/**
* Exports information about a binary to a local folder in XML format.
*
* @param resultFolder the folder where the results will be stored
* @param query the query object containing the params of the query
* @throws IOException if there's an error establishing the database connection
* @throws LSHException if there's an error issuing the query
*/
protected void doDumpSigs(File resultFolder, QueryName query) throws IOException, LSHException {
if (!resultFolder.isDirectory()) {
throw new IOException(resultFolder.getAbsolutePath() + " is not a valid directory");
}
DatabaseInformation info = establishQueryServerConnection(true);
query.fillinCallgraph = info.trackcallgraph;
ResponseName responseName = query.execute(querydb);
if (responseName == null) {
BSimError lastError = querydb.getLastError();
throw new LSHException(lastError.message);
}
if (!responseName.uniqueexecutable) {
throw new LSHException("Could not determine unique executable");
}
ExecutableRecord exe;
if (!StringUtils.isAllBlank(query.spec.exemd5)) {
exe = responseName.manage.findExecutable(query.spec.exemd5);
}
else {
exe = responseName.manage.findExecutable(query.spec.exename, query.spec.arch,View on GitHub (pinned to d5f144c24d)
Solutions
- Create the directory before calling doDumpSigs: resultFolder.mkdirs().
- Verify the path is not already occupied by a regular file.
- Check write permissions on the directory and its parent.
- Use an absolute path to avoid working-directory ambiguity.
Example fix
// before
if (!resultFolder.isDirectory()) {
throw new IOException(resultFolder.getAbsolutePath() + " is not a valid directory");
}
// after — attempt creation, then validate
if (!resultFolder.exists()) {
if (!resultFolder.mkdirs()) {
throw new IOException("Cannot create output directory: " + resultFolder.getAbsolutePath());
}
} else if (!resultFolder.isDirectory()) {
throw new IOException(resultFolder.getAbsolutePath() + " is not a directory");
} Defensive patterns
Strategy: validation
Validate before calling
// Ensure the output directory exists and is writable before calling doDumpSigs
if (resultFolder == null) {
throw new IllegalArgumentException("resultFolder must not be null");
}
if (!resultFolder.exists()) {
resultFolder.mkdirs();
}
if (!resultFolder.isDirectory()) {
throw new IllegalArgumentException(
"resultFolder is not a directory: " + resultFolder.getAbsolutePath());
}
if (!resultFolder.canWrite()) {
throw new IllegalArgumentException(
"resultFolder is not writable: " + resultFolder.getAbsolutePath());
} Type guard
public static boolean isValidOutputDirectory(File dir) {
return dir != null && dir.isDirectory() && dir.canWrite();
} Try / catch
// Validation-based; create directory proactively
if (!resultFolder.exists()) {
resultFolder.mkdirs();
}
bulk.doDumpSigs(resultFolder, query); Prevention
- Create the output directory with mkdirs() before calling doDumpSigs.
- Check canWrite() to catch read-only filesystem issues early.
- Use absolute paths for output directories to avoid ambiguity.
When it happens
Trigger: Calling doDumpSigs with a resultFolder path that doesn't exist, points to a file, or is a broken symlink. The check is purely isDirectory() — no writability test.
Common situations: User specifies an output folder that hasn't been created yet; the path points to an existing file; the directory is on a read-only mount; typo in the folder path.
Related errors
- {inputFile.getAbsolutePath()} is not an XML file
- Must specify "md5=" or "name="
- Could not determine unique executable
- Executable
- Expecting privilege option (admin or user)
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e962cfb64e4480c1.
Report an issue: GitHub.