NationalSecurityAgency/ghidra · error · FileNotFoundException
Unable to find weights file: {weightsfile}
Error message
Unable to find weights file: {weightsfile} What it means
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.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java:92
parser.start("dbconfig");
info = new DatabaseInformation();
info.restoreXml(parser);
parser.start("k");
k = SpecXmlUtils.decodeInt(parser.end().getText());
parser.start("L");
L = SpecXmlUtils.decodeInt(parser.end().getText());
parser.start("weightsfile");
String weightsfile = parser.end().getText();
parser.end();
weightfactory = new WeightFactory();
idflookup = new IDFLookup();
if (weightsfile.equals("default")) {
return; // Use the default weights
}
file = new ResourceFile(rootPath, weightsfile);
if (!file.exists()) {
throw new FileNotFoundException("Unable to find weights file: "+weightsfile);
}
parser =
new NonThreadedXmlPullParserImpl(file.getInputStream(), file.getName(), handler, false);
parser.start("weights");
weightfactory.restoreXml(parser);
idflookup.restoreXml(parser);
parser.end();
}
}
View on GitHub (pinned to d5f144c24d)
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.
Example fix
<!-- before --> <weightsfile>custom_weights</weightsfile> <!-- file missing --> <!-- after --> <weightsfile>default</weightsfile>
Defensive patterns
Strategy: validation
Validate before calling
// Inspect the template XML; if weightsfile != "default", verify:
ResourceFile wf = new ResourceFile(rootPath, weightsfileName);
if (!wf.exists()) {
throw new IllegalArgumentException("Weights file missing: " + wf);
} Try / catch
catch (FileNotFoundException e) { /* fall back to 'default' weights or surface missing file name to user */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to find configuration template
- Could open module data directory
- Function tag does not exist: {}
- Protocol not permissable for BSim URL
- BSim URL missing DB name/path
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/eef63f6b024cab1f.
Report an issue: GitHub.