NationalSecurityAgency/ghidra · error · IllegalArgumentException
Unknown script name {scriptSource}
Error message
Unknown script name {scriptSource} What it means
compile only knows a single script: VectorCompareScriptFactory.SCRIPT_NAME. BSim does not accept arbitrary source text; it dispatches by registered name. If scriptSource is not exactly that name, IllegalArgumentException is thrown with the offending source.
Source
Thrown at Ghidra/Extensions/BSimElasticPlugin/src/org/elasticsearch/plugin/analysis/lsh/BSimScriptEngine.java:36
import java.util.*;
import org.elasticsearch.script.*;
public class BSimScriptEngine implements ScriptEngine {
private final static String ENGINE_NAME = "bsim_scripts";
@Override
public <FactoryType> FactoryType compile(String scriptName, String scriptSource,
ScriptContext<FactoryType> context, Map<String, String> params) {
if (context.equals(ScoreScript.CONTEXT) == false) {
throw new IllegalArgumentException(
getType() + "scripts cannot be used for context [" + context.name + "]");
}
if (VectorCompareScriptFactory.SCRIPT_NAME.equals(scriptSource)) {
ScoreScript.Factory factory = new VectorCompareScriptFactory();
return context.factoryClazz.cast(factory);
}
throw new IllegalArgumentException("Unknown script name " + scriptSource);
}
@Override
public void close() {
// Can free up resources
}
@Override
public Set<ScriptContext<?>> getSupportedContexts() {
return Collections.singleton(ScoreScript.CONTEXT);
}
@Override
public String getType() {
return ENGINE_NAME;
}
}View on GitHub (pinned to d5f144c24d)
Solutions
- Reference VectorCompareScriptFactory.SCRIPT_NAME exactly in the script id.
- Check the query's script id against the installed plugin version.
- Use the constant from the plugin rather than a hard-coded string to avoid drift.
Example fix
// before: wrong/typo script name new Script(ScriptType.INLINE, "bsim_scripts", "vector_compare", params) // may be wrong // after: use the plugin's registered script name new Script(ScriptType.INDEXED, "bsim_scripts", VectorCompareScriptFactory.SCRIPT_NAME, params)
Defensive patterns
Strategy: validation
Validate before calling
if (!VectorCompareScriptFactory.SCRIPT_NAME.equals(scriptSource)) {
throw new IllegalArgumentException("Unknown BSim script: " + scriptSource);
} Prevention
- Reference the script via the VectorCompareScriptFactory.SCRIPT_NAME constant.
- Keep the client query's script id in sync with the installed plugin version.
When it happens
Trigger: Passing a script source/id other than VectorCompareScriptFactory.SCRIPT_NAME - a typo, a wrong/stale id in the query JSON, source text instead of the name, or a renamed script in a different plugin version.
Common situations: A query referencing a script name that was renamed/removed; copy-paste of a wrong id; a version mismatch between client query and installed plugin; passing the literal vector text as the script source.
Related errors
- {getType()}scripts cannot be used for context [{context.name
- Could not find hits document
- No functions matching vectorid:
- Multi-search for exe records failed
- Could not recover unique executable via id
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e67428216455cafa.
Report an issue: GitHub.