{"record":{"id":"f6d3c5d53915257b","repo":"NationalSecurityAgency/ghidra","slug":"failed-to-create-the-jython-src-directory-at-jyt","errorCode":null,"errorMessage":"Failed to create the jython-src directory at: {jythonSrcDestDir}","messagePattern":"Failed to create the jython-src directory at: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java","lineNumber":77,"sourceCode":"\t * some installations will not have the appropriate directory permissions to create new files in.\n\t * \n\t * @param monitor A monitor to use during the cache directory setup.\n\t * @return The jython cache directory.\n\t * @throws IOException If there was a disk-related problem setting up the cache directory.\n\t * @throws CancelledException If the user cancelled the setup.\n\t */\n\tpublic static File setupJythonCacheDir(TaskMonitor monitor)\n\t\t\tthrows CancelledException, IOException {\n\n\t\tFile devDir = new File(Application.getUserSettingsDirectory(), \"dev\");\n\t\tFile cacheDir = new File(devDir, JYTHON_CACHEDIR);\n\t\tif (!FileUtilities.mkdirs(cacheDir)) {\n\t\t\tthrow new IOException(\"Failed to create the jython cache directory at: \" + cacheDir);\n\t\t}\n\n\t\tFile jythonSrcDestDir = new File(cacheDir, JYTHON_SRC);\n\t\tif (!FileUtilities.createDir(jythonSrcDestDir)) {\n\t\t\tthrow new IOException(\n\t\t\t\t\"Failed to create the \" + JYTHON_SRC + \" directory at: \" + jythonSrcDestDir);\n\t\t}\n\n\t\tFile jythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);\n\t\tFile jythonSrcDir = new File(jythonModuleDir, JYTHON_SRC);\n\t\tif (!jythonSrcDir.exists()) {\n\t\t\ttry {\n\t\t\t\tjythonSrcDir = Application.getModuleDataSubDirectory(jythonModuleDir.getName(),\n\t\t\t\t\tJYTHON_SRC).getFile(false);\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e) {\n\t\t\t\tthrow new IOException(\"Failed to find the module's \" + JYTHON_SRC + \" directory\");\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tFileUtilities.copyDir(jythonSrcDir, jythonSrcDestDir, f -> f.getName().endsWith(\".py\"),\n\t\t\t\tmonitor);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java#L59-L95","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"import java.io.File;\nFile jsrc = new File(new File(new File(\n    Application.getUserSettingsDirectory(), \"dev\"), \"jython_cachedir\"), \"jython-src\");\nif (jsrc.exists() && !jsrc.isDirectory()) {\n    // a file is blocking the dir creation; remove it before init\n}","typeGuard":"null","tryCatchPattern":"try {\n    GhidraJythonInterpreter.get();\n} catch (NullPointerException npe) {\n    // clean jython_cachedir and retry once\n}","preventionTips":["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."],"tags":["jython","filesystem","permissions","environment"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}