{"record":{"id":"9d123975850208e6","repo":"NationalSecurityAgency/ghidra","slug":"query-signature-data-does-not-match-database","errorCode":null,"errorMessage":"Query signature data  does not match database ","messagePattern":"Query signature data  does not match database ","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java","lineNumber":224,"sourceCode":"\t * @param query an object describing the query\n\t * @return the response object or null if there is an error\n\t */\n\tpublic QueryResponseRecord query(BSimQuery<?> query);\n\n\tpublic static void checkSettingsForQuery(DescriptionManager manage, DatabaseInformation info)\n\t\t\tthrows LSHException {\n\t\tfinal int res = info.checkSignatureSettings(manage.getMajorVersion(),\n\t\t\tmanage.getMinorVersion(), manage.getSettings());\n\t\tif (res <= 1) {\n\t\t\treturn;\n\t\t}\n\t\tif (res == 4) {\n\t\t\treturn;\n\t\t}\n\t\tif (res == 3) {\n\t\t\tthrow new LSHException(\"Query signature data has no setting information\");\n\t\t}\n\t\tthrow new LSHException(\"Query signature data \" +\n\t\t\tgetFormattedVersion(manage.getMajorVersion(), manage.getMinorVersion(),\n\t\t\t\tmanage.getSettings()) +\n\t\t\t\" does not match database \" +\n\t\t\tgetFormattedVersion(info.major, info.minor, info.settings));\n\t}\n\n\tprivate static String getFormattedVersion(int maj, int min, int settings) {\n\t\treturn String.format(\"%d.%d:0x%02x\", maj, min, settings);\n\t}\n\n\tpublic static boolean checkSettingsForInsert(DescriptionManager manage,\n\t\t\tDatabaseInformation info) throws LSHException, DatabaseNonFatalException {\n\t\tif (manage.numFunctions() == 0) {\n\t\t\tthrow new DatabaseNonFatalException(\"Empty signature file\");\n\t\t}\n\t\tint res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(),\n\t\t\tmanage.getSettings());\n\t\tif (res == 0) {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java#L206-L242","documentation":"Thrown by FunctionDatabase.checkSettingsForQuery when the query signature data's version/settings do not match the database's (checkSignatureSettings returns 2, indicating a major-version or settings mismatch, or minor versions that differ by more than 1). BSim enforces this so a query is only run against a database with compatible signature settings, preventing meaningless similarity comparisons.","triggerScenarios":"Calling checkSettingsForQuery where the DescriptionManager's (major,minor,settings) differ from the DatabaseInformation's stored values. Res == 2 specifically: major version mismatch, settings value mismatch, or minor versions more than 1 apart.","commonSituations":"The query signature file was generated with a different BSim configuration or a different major Ghidra version than the target database. Mixing signature files from different BSim databases or different deployments. Upgrading Ghidra and querying an old database with newly-generated signatures.","solutions":["Regenerate the query signature file using the same Ghidra version and BSim configuration used to populate the target database.","Check the formatted versions in the exception text: align the query's major version and settings (0x..) to the database's values.","If the database itself is stale, rebuild the BSim database from current signatures so both sides share identical settings.","Confirm you are pointing the query at the correct database instance."],"exampleFix":"// before\n// Querying db built with settings 0x05 using signatures built with settings 0x06\nFunctionDatabase.checkSettingsForQuery(manage, info);\n// after\n// Regenerate signatures with the same configuration as the database\nFunctionDatabase.checkSettingsForQuery(manage, info); // versions now match","handlingStrategy":"try-catch","validationCode":"// Compare versions before calling checkSettingsForQuery\nint res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings());\nif (res == 2) {\n    throw new IllegalStateException(String.format(\n        \"Query settings %d.%d:0x%02x do not match db %d.%d:0x%02x; regenerate signatures or rebuild db\",\n        manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings(),\n        info.major, info.minor, info.settings));\n}\nFunctionDatabase.checkSettingsForQuery(manage, info);","typeGuard":null,"tryCatchPattern":"try {\n    FunctionDatabase.checkSettingsForQuery(manage, info);\n} catch (LSHException e) {\n    if (e.getMessage().contains(\"does not match database\")) {\n        log.error(\"Settings/version mismatch between query signatures and database\", e);\n    }\n    throw e;\n}","preventionTips":["Pin the Ghidra/BSim version used to build the database and to generate query signatures.","Read the database's recorded settings and compare to your signature file before querying.","Treat a settings mismatch as a pipeline-consistency bug, not a runtime hiccup."],"tags":["bsim","signature-settings","version-mismatch"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}