{"record":{"id":"f32f7f342c368897","repo":"NationalSecurityAgency/ghidra","slug":"unable-to-find-configuration-template","errorCode":null,"errorMessage":"Unable to find configuration template","messagePattern":"Unable to find configuration template","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java","lineNumber":69,"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\tweightfactory = new WeightFactory();\n\t\tweightfactory.restoreXml(parser);\n\t\tidflookup = new IDFLookup();\n\t\tidflookup.restoreXml(parser);\n\t\tparser.end();\n\t}\n\t\n\tpublic void loadTemplate(ResourceFile rootPath, String filename)\n\t\t\tthrows SAXException, IOException {\n\t\tResourceFile file = new ResourceFile(rootPath, filename + \".xml\");\n\t\tif (!file.exists()) {\n\t\t\tthrow new FileNotFoundException(\"Unable to find configuration template\");\n\t\t}\n\t\tErrorHandler handler = SpecXmlUtils.getXmlHandler();\n\t\tXmlPullParser parser =\n\t\t\tnew NonThreadedXmlPullParserImpl(file.getInputStream(), file.getName(), handler, false);\n\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\")) {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/Configuration.java#L51-L87","documentation":"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.","triggerScenarios":"Calling Configuration.loadTemplate(rootPath, filename) where rootPath/filename + '.xml' does not exist; wrong rootPath; missing or renamed template file; classpath/resource path not resolving.","commonSituations":"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.","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."],"exampleFix":"// before\ncfg.loadTemplate(rootPath, \"template_nosub\"); // file missing\n// after\nResourceFile f = new ResourceFile(rootPath, \"template_nosub.xml\");\nif (!f.exists()) throw new IllegalStateException(\"Template not found: \" + f);\ncfg.loadTemplate(rootPath, \"template_nosub\");","handlingStrategy":"validation","validationCode":"ResourceFile f = new ResourceFile(rootPath, filename + \".xml\");\nif (!f.exists()) {\n    throw new IllegalArgumentException(\"Template missing: \" + f.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"catch (FileNotFoundException e) { /* provide user with expected path, offer template directory picker */ }","preventionTips":["Validate template file existence before loadTemplate.","Bundle required templates with your deployment or point to the Ghidra install.","Use absolute paths for rootPath."],"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"}