{"record":{"id":"eef63f6b024cab1f","repo":"NationalSecurityAgency/ghidra","slug":"unable-to-find-weights-file-weightsfile","errorCode":null,"errorMessage":"Unable to find weights file: {weightsfile}","messagePattern":"Unable to find weights file: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java","lineNumber":92,"sourceCode":"\t\tparser.start(\"dbconfig\");\n\t\tinfo = new DatabaseInformation();\n\t\tinfo.restoreXml(parser);\n\t\tparser.start(\"k\");\n\t\tk = SpecXmlUtils.decodeInt(parser.end().getText());\n\t\tparser.start(\"L\");\n\t\tL = SpecXmlUtils.decodeInt(parser.end().getText());\n\t\tparser.start(\"weightsfile\");\n\t\tString weightsfile = parser.end().getText();\n\t\tparser.end();\n\t\tweightfactory = new WeightFactory();\n\t\tidflookup = new IDFLookup();\n\t\t\n\t\tif (weightsfile.equals(\"default\")) {\n\t\t\treturn;\t\t\t\t\t\t\t\t// Use the default weights\n\t\t}\n\t\tfile = new ResourceFile(rootPath, weightsfile);\n\t\tif (!file.exists()) {\n\t\t\tthrow new FileNotFoundException(\"Unable to find weights file: \"+weightsfile);\n\t\t}\n\t\tparser =\n\t\t\tnew NonThreadedXmlPullParserImpl(file.getInputStream(), file.getName(), handler, false);\n\t\tparser.start(\"weights\");\n\t\tweightfactory.restoreXml(parser);\n\t\tidflookup.restoreXml(parser);\n\t\tparser.end();\n\t}\n}\n","sourceCodeStart":74,"sourceCodeEnd":102,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java#L74-L102","documentation":"Thrown by Configuration.loadTemplate after reading the dbconfig XML if the <weightsfile> element names a non-'default' file that does not exist at rootPath/weightsfile. The weights file contains LSH weight/IDF data needed to initialize the WeightFactory and IDFLookup; a missing file prevents proper vector configuration.","triggerScenarios":"The template XML references a weightsfile value other than 'default', but the named file is absent from rootPath; weights file deleted, moved, or not deployed alongside the template.","commonSituations":"Custom LSH weight sets referenced by a template but not shipped; partial deployment of template directory; weights file renamed during an upgrade; typo in the weightsfile element.","solutions":["Ensure the weights file named in the template exists in rootPath before calling loadTemplate.","Set the template's <weightsfile> element to 'default' if custom weights are not needed.","Ship the weights file with the template in the same directory."],"exampleFix":"<!-- before -->\n<weightsfile>custom_weights</weightsfile> <!-- file missing -->\n<!-- after -->\n<weightsfile>default</weightsfile>","handlingStrategy":"validation","validationCode":"// Inspect the template XML; if weightsfile != \"default\", verify:\nResourceFile wf = new ResourceFile(rootPath, weightsfileName);\nif (!wf.exists()) {\n    throw new IllegalArgumentException(\"Weights file missing: \" + wf);\n}","typeGuard":null,"tryCatchPattern":"catch (FileNotFoundException e) { /* fall back to 'default' weights or surface missing file name to user */ }","preventionTips":["Keep weights files in the same directory as their referencing template.","Use 'default' weights unless a specific tuned weight set is required.","Validate the weights file path during deployment verification."],"tags":["bsim","configuration","filesystem","missing-file"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}