{"record":{"id":"e67428216455cafa","repo":"NationalSecurityAgency/ghidra","slug":"unknown-script-name-scriptsource","errorCode":null,"errorMessage":"Unknown script name {scriptSource}","messagePattern":"Unknown script name (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Extensions/BSimElasticPlugin/src/org/elasticsearch/plugin/analysis/lsh/BSimScriptEngine.java","lineNumber":36,"sourceCode":"import java.util.*;\n\nimport org.elasticsearch.script.*;\n\npublic class BSimScriptEngine implements ScriptEngine {\n\tprivate final static String ENGINE_NAME = \"bsim_scripts\";\n\n\t@Override\n\tpublic <FactoryType> FactoryType compile(String scriptName, String scriptSource,\n\t\t\tScriptContext<FactoryType> context, Map<String, String> params) {\n\t\tif (context.equals(ScoreScript.CONTEXT) == false) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\tgetType() + \"scripts cannot be used for context [\" + context.name + \"]\");\n\t\t}\n\t\tif (VectorCompareScriptFactory.SCRIPT_NAME.equals(scriptSource)) {\n\t\t\tScoreScript.Factory factory = new VectorCompareScriptFactory();\n\t\t\treturn context.factoryClazz.cast(factory);\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Unknown script name \" + scriptSource);\n\t}\n\n\t@Override\n\tpublic void close() {\n\t\t// Can free up resources\n\t}\n\n\t@Override\n\tpublic Set<ScriptContext<?>> getSupportedContexts() {\n\t\treturn Collections.singleton(ScoreScript.CONTEXT);\n\t}\n\n\t@Override\n\tpublic String getType() {\n\t\treturn ENGINE_NAME;\n\t}\n\n}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/BSimElasticPlugin/src/org/elasticsearch/plugin/analysis/lsh/BSimScriptEngine.java#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: wrong/typo script name\nnew Script(ScriptType.INLINE, \"bsim_scripts\", \"vector_compare\", params) // may be wrong\n// after: use the plugin's registered script name\nnew Script(ScriptType.INDEXED, \"bsim_scripts\", VectorCompareScriptFactory.SCRIPT_NAME, params)","handlingStrategy":"validation","validationCode":"if (!VectorCompareScriptFactory.SCRIPT_NAME.equals(scriptSource)) {\n    throw new IllegalArgumentException(\"Unknown BSim script: \" + scriptSource);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference the script via the VectorCompareScriptFactory.SCRIPT_NAME constant.","Keep the client query's script id in sync with the installed plugin version."],"tags":["elasticsearch","bsim","scripting","query"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}