NationalSecurityAgency/ghidra · error · LSHException

Could open module data directory

Error message

Could open module data directory

What it means

Thrown by FunctionDatabase.loadConfigurationTemplate when an IOException (other than FileNotFoundException) occurs while reading or opening the module data directory or template. Note the message 'Could open module data directory' is grammatically incomplete (it means 'could NOT open'); it wraps the underlying IOException but does not append its message.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java:315

		}
		else {
			res = newrec.getNameExec() + " already ingested with UNKNOWN difference in metadata";
		}
		return res;
	}

	public static Configuration loadConfigurationTemplate(String configname) throws LSHException {
		ResourceFile moduleDataSubDirectory;
		final Configuration config = new Configuration();
		try {
			moduleDataSubDirectory = Application.getModuleDataSubDirectory("");
			config.loadTemplate(moduleDataSubDirectory, configname);
		}
		catch (final FileNotFoundException e) {
			throw new LSHException("Missing configuration data: " + e.getMessage());
		}
		catch (final IOException e) {
			throw new LSHException("Could open module data directory");
		}
		catch (final SAXException e) {
			throw new LSHException("Unable to parse configuration template");
		}
		return config;
	}

	/**
	 * Central location for building vector factory used by FunctionDatabase
	 * @return the LSHVectorFactory object
	 */
	public static WeightedLSHCosineVectorFactory generateLSHVectorFactory() {
		return new WeightedLSHCosineVectorFactory();
	}

	/**
	 * Get the maximum number of functions to be queried per staged query when searching
	 * for similar functions.

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Check filesystem read permissions on the Ghidra module data directory and its parent tree.
  2. Confirm the module data directory exists and is not a broken symlink or empty mount point.
  3. Reinstall/repair the Ghidra distribution if the directory is missing or corrupt.
  4. Run Ghidra from a fully-installed, readable location rather than a temp/extracted archive.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the module data directory is readable before loading
ResourceFile dir = Application.getModuleDataSubDirectory("");
if (!dir.exists() || !dir.isDirectory()) {
    throw new IllegalStateException("Module data directory missing or unreadable: " + dir);
}
Configuration config = FunctionDatabase.loadConfigurationTemplate(configname);

Try / catch

try {
    Configuration config = FunctionDatabase.loadConfigurationTemplate(configname);
} catch (LSHException e) {
    if (e.getMessage().equals("Could open module data directory")) {
        log.error("Cannot read BSim module data directory; check permissions/installation", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Application.getModuleDataSubDirectory("") or config.loadTemplate throws a generic IOException: permission denied, I/O error reading the directory, or the directory exists but is unreadable. The catch swallows the original message, so only the generic string surfaces.

Common situations: Filesystem permissions prevent reading the module data directory. The directory was deleted or is a broken symlink. A disk I/O error or locked file on Windows. Running Ghidra from a read-only or partially-mounted location.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/68681ab3bd6eca7c. Report an issue: GitHub.