{"record":{"id":"83a250a83695a491","repo":"NationalSecurityAgency/ghidra","slug":"missing-database-template","errorCode":null,"errorMessage":"Missing database template","messagePattern":"Missing database template","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":534,"sourceCode":"\t/**\n\t * Runs the command specified by the given set of params.\n\t * \n\t * @param params the parameters specifying the command\n\t * @throws Exception when initializing the application or executing the command\n\t */\n\tpublic void run(String[] params) throws Exception {\n\t\trun(params, TaskMonitor.DUMMY);\n\t}\n\n\t/**\n\t * Creates a new BSim database with a given set of properties.\n\t * \n\t * @param params the command-line parameters\n\t * @throws IOException if there's an error establishing the database connection\n\t */\n\tprivate void doCreateDatabase(List<String> params) throws IOException {\n\t\tif (params.isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"Missing database template\");\n\t\t}\n\t\telse if (params.size() > 1) {\n\t\t\tthrow new IllegalArgumentException(\"Unexpected parameter: \" + params.get(1));\n\t\t}\n\n\t\tString configTemplate = params.get(0);\n\t\tboolean noTrackCallGraph = booleanOptions.contains(NO_CALLGRAPH_OPTION);\n\n\t\tString nameOption = optionValueMap.get(NAME_OPTION);\n\t\tString ownerOption = optionValueMap.get(OWNER_OPTION);\n\t\tString descOption = optionValueMap.get(DESCRIPTION_OPTION);\n\n\t\ttry (BulkSignatures bsim = getBulkSignatures()) {\n\t\t\tbsim.createDatabase(configTemplate, nameOption, ownerOption, descOption,\n\t\t\t\t!noTrackCallGraph);\n\t\t}\n\t}\n","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L516-L552","documentation":"Thrown by doCreateDatabase() when the positional params list (after the bsimURL is consumed) is empty. The createdatabase command requires a config template name as its second positional argument (large_32, medium_32, medium_64, medium_cpool, medium_nosize) to define the BSim database's signature characteristics. Without it, the database schema cannot be determined.","triggerScenarios":"Running 'bsim createdatabase <bsimURL>' with no template argument. checkRequiredParam at index 1 validates the URL, then readOptions returns an empty subParams list, so params.isEmpty() is true at line 533.","commonSituations":"Forgetting the template is mandatory; confusing the order (template must come after bsimURL); copy-pasting an example that omitted the template; misspelling a known template so readOptions treats it as an option prefix.","solutions":["Append a config template name: one of large_32, medium_32, medium_64, medium_cpool, medium_nosize.","Run 'bsim' with no args to see the usage line for createdatabase (line 1024) and the enumerated templates (line 1052).","If scripting, validate the template is non-empty before invoking run()."],"exampleFix":"// before\nbsim createdatabase postgresql://myhost/BsimDB\n// after\nbsim createdatabase postgresql://myhost/BsimDB medium_64","handlingStrategy":"validation","validationCode":"// Before run(): confirm the createdatabase command has a template positional\n// params[0]=\"createdatabase\", params[1]=bsimURL, params[2] must be a template\nif (\"createdatabase\".equals(params[0]) && params.length < 3) {\n    throw new IllegalArgumentException(\"createdatabase requires a config template: large_32|medium_32|medium_64|medium_cpool|medium_nosize\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check params.length >= 3 for createdatabase before invoking run().","Validate the template against the known set before sending."],"tags":["cli","argument-validation","bsim","createdatabase"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}