{"record":{"id":"2a0cc9fba467d65c","repo":"NationalSecurityAgency/ghidra","slug":"script-does-not-exist-scriptname","errorCode":null,"errorMessage":"Script does not exist: {scriptName}","messagePattern":"Script does not exist: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonScript.java","lineNumber":67,"sourceCode":"\t\t}\n\t}\n\n\t@Override\n\tpublic void runScript(String scriptName, GhidraState scriptState) throws Exception {\n\t\tGhidraJythonInterpreter interpreter =\n\t\t\t(GhidraJythonInterpreter) state.getEnvironmentVar(JYTHON_INTERPRETER);\n\t\tif (interpreter == null) {\n\t\t\tinterpreter = GhidraJythonInterpreter.get();\n\t\t\tif (interpreter == null) {\n\t\t\t\tthrow new AssertException(\"Could not get Ghidra Jython interpreter!\");\n\t\t\t}\n\t\t}\n\t\tResourceFile scriptSource = GhidraScriptUtil.findScriptByName(scriptName);\n\t\tif (scriptSource != null) {\n\t\t\tGhidraScriptProvider provider = GhidraScriptUtil.getProvider(scriptSource);\n\t\t\tGhidraScript ghidraScript = provider.getScriptInstance(scriptSource, errorWriter);\n\t\t\tif (ghidraScript == null) {\n\t\t\t\tthrow new IllegalArgumentException(\"Script does not exist: \" + scriptName);\n\t\t\t}\n\n\t\t\tif (scriptState == state) {\n\t\t\t\tupdateStateFromVariables();\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tinterpreter.saveLocals();\n\t\t\t\tinterpreter.clearLocals();\n\t\t\t\tif (ghidraScript instanceof JythonScript) {\n\t\t\t\t\tghidraScript.set(scriptState);\n\t\t\t\t\tJythonScript jythonScript = (JythonScript) ghidraScript;\n\t\t\t\t\tinterpreter.execFile(jythonScript.getSourceFile(), jythonScript);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tghidraScript.execute(scriptState, getControls());\n\t\t\t\t}\n\t\t\t}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonScript.java#L49-L85","documentation":"Thrown inside JythonScript.runScript() when GhidraScriptUtil.findScriptByName(scriptName) located a file and a provider was found, but provider.getScriptInstance(sourceFile, errorWriter) returned null — meaning the script class could not be instantiated/loaded. Despite the 'does not exist' wording, the file exists; the instance failed to load (compile error, missing class, provider problem).","triggerScenarios":"runScript(scriptName, state) where the named script file is registered but getScriptInstance() fails to produce a GhidraScript (e.g. the .py has a syntax error under Jython, a Java script failed classloading, or the provider could not compile the source); the errorWriter received the real cause before null was returned.","commonSituations":"Calling runScript() for a script with a compile/load error; a stale compiled class bundle; a Jython script referencing a removed API; script directories pointing at half-edited files.","solutions":["Inspect the errorWriter / console output — getScriptInstance already logged the underlying load failure there; fix that root cause (syntax error, missing import, etc.).","Verify the script's provider can compile the source standalone (run it directly from the Script Manager).","If the file is genuinely malformed, remove or fix it before invoking runScript()."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"ResourceFile f = GhidraScriptUtil.findScriptByName(scriptName);\nif (f == null) { /* not registered -> 623 */ }\nGhidraScriptProvider p = GhidraScriptUtil.getProvider(f);\nStringWriter sw = new StringWriter();\nGhidraScript g = p.getScriptInstance(f, new PrintWriter(sw));\nif (g == null) { /* inspect sw for the load error, do not call runScript */ }","typeGuard":"null","tryCatchPattern":"try {\n    runScript(name, state);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Script does not exist\")) {\n        // distinguish 622 vs 623 by checking findScriptByName(name) != null\n        // 622 => file exists but failed to load; surface the provider's logged error\n    } else throw e;\n}","preventionTips":["Run new scripts in the Script Manager first to confirm they compile/instantiate.","Keep script dependencies (imports) valid against the current Ghidra API.","Log the errorWriter contents from getScriptInstance for diagnosis."],"tags":["jython","ghidra-script","script-loading"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}