{"record":{"id":"967fc3d8e7f7b7f2","repo":"NationalSecurityAgency/ghidra","slug":"failed-to-find-the-module-s-jython-src-directory","errorCode":null,"errorMessage":"Failed to find the module's jython-src directory","messagePattern":"Failed to find the module's jython-src directory","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java","lineNumber":89,"sourceCode":"\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);\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new IOException(\n\t\t\t\t\"Failed to copy \" + JYTHON_SRC + \" files to: \" + jythonSrcDestDir);\n\t\t}\n\n\t\tSystem.setProperty(\"python.cachedir.skip\", \"false\");\n\t\tSystem.setProperty(\"python.cachedir\", cacheDir.getAbsolutePath());\n\t\tSystem.setProperty(\"python.path\", jythonSrcDestDir.getAbsolutePath());\n\n\t\treturn cacheDir;\n\t}","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonUtils.java#L71-L107","documentation":"Thrown by JythonUtils.setupJythonCacheDir() when the module's jython-src directory cannot be found. It first checks <moduleRoot>/jython-src, and if absent tries Application.getModuleDataSubDirectory(moduleName, 'jython-src'); a FileNotFoundException from that lookup triggers this IOException. The source .py files to seed the cache are therefore missing.","triggerScenarios":"Interpreter init where the Jython extension module data did not include the jython-src tree — e.g. a partial install where jython-2.7.4 home exists but the source bundle was not laid down, or a dev build that skipped copying jython-src.","commonSituations":"Trimmed/custom distribution that shipped the Jython home but not jython-src; a module layout change after upgrade; an extension rebuild that omitted the data copy step.","solutions":["Reinstall/repair the Jython extension so its module data contains jython-src.","In dev mode, run the module data build/copy task to populate jython-src under the module.","Confirm Application.getMyModuleRootDirectory() points at the Jython module and that its data subdirectory is intact."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"import java.io.File;\nFile moduleRoot = Application.getMyModuleRootDirectory().getFile(false);\nFile src = new File(moduleRoot, \"jython-src\");\nif (!src.exists()) {\n    // module data missing jython-src; repair/extend before interpreter init\n}","typeGuard":"null","tryCatchPattern":"try {\n    GhidraJythonInterpreter.get();\n} catch (NullPointerException npe) {\n    // get() swallowed the IOException and returned null; verify module data\n}","preventionTips":["Reinstall the Jython extension with its full data tree.","Run the dev build task that copies jython-src into module data.","Confirm Application.getMyModuleRootDirectory() resolves to the Jython module."],"tags":["jython","installation","module-data","environment"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}