NationalSecurityAgency/ghidra · error · IOException
Failed to create the jython-src directory at: {jythonSrcDest
Error message
Failed to create the jython-src directory at: {jythonSrcDestDir} What it means
Thrown by JythonUtils.setupJythonCacheDir() when FileUtilities.createDir() fails on the 'jython-src' subdirectory inside the cache (<settings>/dev/jython_cachedir/jython-src). Occurs immediately after the cache dir itself was created successfully, so it points to a problem creating one nested folder (race, permission inheritance, or an existing non-dir entry).
Source
Thrown at Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java:77
* 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");
}
}
try {
FileUtilities.copyDir(jythonSrcDir, jythonSrcDestDir, f -> f.getName().endsWith(".py"),
monitor);View on GitHub (pinned to d5f144c24d)
Solutions
- Inspect <settings>/dev/jython_cachedir and remove any non-directory entry named jython-src, then retry.
- Verify the user can create subdirectories inside jython_cachedir (permissions/SELinux context).
- Clear the whole jython_cachedir and let setup rebuild it from scratch.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
import java.io.File;
File jsrc = new File(new File(new File(
Application.getUserSettingsDirectory(), "dev"), "jython_cachedir"), "jython-src");
if (jsrc.exists() && !jsrc.isDirectory()) {
// a file is blocking the dir creation; remove it before init
} Type guard
null
Try / catch
try {
GhidraJythonInterpreter.get();
} catch (NullPointerException npe) {
// clean jython_cachedir and retry once
} Prevention
- Clear <settings>/dev/jython_cachedir if a previous run left junk.
- Avoid concurrent interpreter initializations sharing one cache.
- Ensure consistent permissions on nested cache subdirectories.
When it happens
Trigger: Cache directory exists but the jython-src child cannot be created; e.g. an existing file named jython-src, a transient I/O error, or a filesystem that disallowed the nested mkdir.
Common situations: A leftover file (not directory) named 'jython-src' from a prior crashed run inside jython_cachedir; antivirus/SELinux blocking nested dir creation; concurrent interpreter inits racing on the same cache.
Related errors
- Failed to create the jython cache directory at: {cacheDir}
- Failed to copy jython-src files to: {jythonSrcDestDir}
- Failed to find the jython home directory at: {jythonHomeDir}
- Failed to find the module's jython-src directory
- %s: error: @-file refers to a directory\n
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/f6d3c5d53915257b.
Report an issue: GitHub.