NationalSecurityAgency/ghidra · error · FileNotFoundException
Unable to find configuration template
Error message
Unable to find configuration template
What it means
Thrown by Configuration.loadTemplate when the expected template file (rootPath/filename.xml) does not exist on disk. loadTemplate reads a BSim database configuration template (dbconfig XML) that defines k, L, weights, and database metadata; without it, database creation cannot proceed.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java:69
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());
weightfactory = new WeightFactory();
weightfactory.restoreXml(parser);
idflookup = new IDFLookup();
idflookup.restoreXml(parser);
parser.end();
}
public void loadTemplate(ResourceFile rootPath, String filename)
throws SAXException, IOException {
ResourceFile file = new ResourceFile(rootPath, filename + ".xml");
if (!file.exists()) {
throw new FileNotFoundException("Unable to find configuration template");
}
ErrorHandler handler = SpecXmlUtils.getXmlHandler();
XmlPullParser parser =
new NonThreadedXmlPullParserImpl(file.getInputStream(), file.getName(), handler, false);
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")) {View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the template XML exists at rootPath.getAbsolutePath() + '/' + filename + '.xml' before calling loadTemplate.
- Use the correct Ghidra application root or BSim settings directory that ships the templates.
- If using a custom path, ensure it is absolute and readable.
Example fix
// before
cfg.loadTemplate(rootPath, "template_nosub"); // file missing
// after
ResourceFile f = new ResourceFile(rootPath, "template_nosub.xml");
if (!f.exists()) throw new IllegalStateException("Template not found: " + f);
cfg.loadTemplate(rootPath, "template_nosub"); Defensive patterns
Strategy: validation
Validate before calling
ResourceFile f = new ResourceFile(rootPath, filename + ".xml");
if (!f.exists()) {
throw new IllegalArgumentException("Template missing: " + f.getAbsolutePath());
} Try / catch
catch (FileNotFoundException e) { /* provide user with expected path, offer template directory picker */ } Prevention
- Validate template file existence before loadTemplate.
- Bundle required templates with your deployment or point to the Ghidra install.
- Use absolute paths for rootPath.
When it happens
Trigger: Calling Configuration.loadTemplate(rootPath, filename) where rootPath/filename + '.xml' does not exist; wrong rootPath; missing or renamed template file; classpath/resource path not resolving.
Common situations: Pointing rootPath at the wrong directory; template renamed or removed in a Ghidra upgrade; custom deployment missing the bundled templates; relative path resolved against unexpected CWD.
Related errors
- Unable to find weights file: {weightsfile}
- 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/f32f7f342c368897.
Report an issue: GitHub.