NationalSecurityAgency/ghidra · error · IllegalArgumentException

Script does not exist: {scriptName}

Error message

Script does not exist: {scriptName}

What it means

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).

Source

Thrown at Ghidra/Extensions/Jython/src/main/java/ghidra/jython/JythonScript.java:67

		}
	}

	@Override
	public void runScript(String scriptName, GhidraState scriptState) throws Exception {
		GhidraJythonInterpreter interpreter =
			(GhidraJythonInterpreter) state.getEnvironmentVar(JYTHON_INTERPRETER);
		if (interpreter == null) {
			interpreter = GhidraJythonInterpreter.get();
			if (interpreter == null) {
				throw new AssertException("Could not get Ghidra Jython interpreter!");
			}
		}
		ResourceFile scriptSource = GhidraScriptUtil.findScriptByName(scriptName);
		if (scriptSource != null) {
			GhidraScriptProvider provider = GhidraScriptUtil.getProvider(scriptSource);
			GhidraScript ghidraScript = provider.getScriptInstance(scriptSource, errorWriter);
			if (ghidraScript == null) {
				throw new IllegalArgumentException("Script does not exist: " + scriptName);
			}

			if (scriptState == state) {
				updateStateFromVariables();
			}

			try {
				interpreter.saveLocals();
				interpreter.clearLocals();
				if (ghidraScript instanceof JythonScript) {
					ghidraScript.set(scriptState);
					JythonScript jythonScript = (JythonScript) ghidraScript;
					interpreter.execFile(jythonScript.getSourceFile(), jythonScript);
				}
				else {
					ghidraScript.execute(scriptState, getControls());
				}
			}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Inspect the errorWriter / console output — getScriptInstance already logged the underlying load failure there; fix that root cause (syntax error, missing import, etc.).
  2. Verify the script's provider can compile the source standalone (run it directly from the Script Manager).
  3. If the file is genuinely malformed, remove or fix it before invoking runScript().

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

ResourceFile f = GhidraScriptUtil.findScriptByName(scriptName);
if (f == null) { /* not registered -> 623 */ }
GhidraScriptProvider p = GhidraScriptUtil.getProvider(f);
StringWriter sw = new StringWriter();
GhidraScript g = p.getScriptInstance(f, new PrintWriter(sw));
if (g == null) { /* inspect sw for the load error, do not call runScript */ }

Type guard

null

Try / catch

try {
    runScript(name, state);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Script does not exist")) {
        // distinguish 622 vs 623 by checking findScriptByName(name) != null
        // 622 => file exists but failed to load; surface the provider's logged error
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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