NationalSecurityAgency/ghidra · critical · IOException

Failed to create the jython cache directory at: {cacheDir}

Error message

Failed to create the jython cache directory at: {cacheDir}

What it means

Thrown by JythonUtils.setupJythonCacheDir() when FileUtilities.mkdirs() fails to create the jython cache directory at <userSettings>/dev/jython_cachedir. This cache holds compiled .py outputs and is intentionally placed outside the install dir to avoid permission problems. mkdirs failing means the parent is not writable or a non-directory file occupies the path.

Source

Thrown at Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java:72

	}

	/**
	 * Sets up the jython cache directory.  This is a temporary space that jython source files
	 * get compiled to and cached.  It should NOT be in the Ghidra installation directory, because
	 * some installations will not have the appropriate directory permissions to create new files in.
	 * 
	 * @param monitor A monitor to use during the cache directory setup.
	 * @return The jython cache directory.
	 * @throws IOException If there was a disk-related problem setting up the cache directory.
	 * @throws CancelledException If the user cancelled the setup.
	 */
	public static File setupJythonCacheDir(TaskMonitor monitor)
			throws CancelledException, IOException {

		File devDir = new File(Application.getUserSettingsDirectory(), "dev");
		File cacheDir = new File(devDir, JYTHON_CACHEDIR);
		if (!FileUtilities.mkdirs(cacheDir)) {
			throw new IOException("Failed to create the jython cache directory at: " + cacheDir);
		}

		File jythonSrcDestDir = new File(cacheDir, JYTHON_SRC);
		if (!FileUtilities.createDir(jythonSrcDestDir)) {
			throw new IOException(
				"Failed to create the " + JYTHON_SRC + " directory at: " + jythonSrcDestDir);
		}

		File jythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);
		File jythonSrcDir = new File(jythonModuleDir, JYTHON_SRC);
		if (!jythonSrcDir.exists()) {
			try {
				jythonSrcDir = Application.getModuleDataSubDirectory(jythonModuleDir.getName(),
					JYTHON_SRC).getFile(false);
			}
			catch (FileNotFoundException e) {
				throw new IOException("Failed to find the module's " + JYTHON_SRC + " directory");
			}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Check write permission on the Ghidra user settings directory (shown in Help -> About -> Ghidra user settings); grant write access to the user.
  2. Remove any non-directory file occupying <settings>/dev/jython_cachedir.
  3. Free disk space / raise quota on the volume holding the settings directory, then retry interpreter creation.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

import ghidra.framework.Application;
import java.io.File;
File cache = new File(new File(Application.getUserSettingsDirectory(), "dev"), "jython_cachedir");
if (!cache.getParentFile().canWrite()) {
    // settings/dev not writable; fix permissions before interpreter init
}

Type guard

null

Try / catch

try {
    GhidraJythonInterpreter.get();
} catch (NullPointerException npe) {
    // get() returns null on IOException; verify <settings>/dev writability
}

Prevention

When it happens

Trigger: Interpreter init where the user settings directory's 'dev' folder cannot be created or the 'jython_cachedir' path is blocked (read-only home, no disk quota, existing file at that name).

Common situations: Running Ghidra as a user whose settings directory is on a read-only mount; restricted/containerized environment where the settings dir lacks write permission; a stale lock file occupying the cache path; full disk.

Related errors


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