{"record":{"id":"efd18213d1800c5f","repo":"NationalSecurityAgency/ghidra","slug":"trying-to-insert-signature-data-with-settings-tha","errorCode":null,"errorMessage":"Trying to insert signature data  with settings that don't match database ","messagePattern":"Trying to insert signature data  with settings that don't match database ","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java","lineNumber":255,"sourceCode":"\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) {\n\t\t\treturn false;\n\t\t}\n\t\tif (res == 1) {\n\t\t\tthrow new LSHException(\n\t\t\t\t\"Trying to insert signature data with slight differences in settings\");\n\t\t}\n\t\tif (res == 4) {\n\t\t\treturn true; // This apparently is the first insert\n\t\t}\n\t\tif (res == 3) {\n\t\t\tthrow new LSHException(\"Trying to insert signature data with no setting information\");\n\t\t}\n\t\tthrow new LSHException(\"Trying to insert signature data \" +\n\t\t\tgetFormattedVersion(manage.getMajorVersion(), manage.getMinorVersion(),\n\t\t\t\tmanage.getSettings()) +\n\t\t\t\" with settings that don't match database \" +\n\t\t\tgetFormattedVersion(info.major, info.minor, info.settings));\n\t}\n\n\tpublic static String constructFatalError(int flags, ExecutableRecord newrec,\n\t\t\tExecutableRecord orig) {\n\t\tString res = null;\n\t\tif ((flags & ExecutableRecord.METADATA_ARCH) != 0) {\n\t\t\tres = newrec.getNameExec() + \" already ingested with different architecture field: \" +\n\t\t\t\torig.getArchitecture();\n\t\t}\n\t\telse if ((flags & ExecutableRecord.METADATA_COMP) != 0) {\n\t\t\tres = newrec.getNameExec() + \" already ingested with different compiler field: \" +\n\t\t\t\torig.getNameCompiler();\n\t\t}\n\t\telse if ((flags & ExecutableRecord.METADATA_LIBR) != 0) {","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java#L237-L273","documentation":"Thrown by FunctionDatabase.checkSettingsForInsert as the fallthrough case when checkSignatureSettings returns 2, meaning the insert payload's major version or settings value differ from the database (or minor versions differ by more than 1). BSim blocks the insert to keep the database's signature settings uniform and comparable.","triggerScenarios":"Inserting signatures whose (major, settings) differ from the database, or whose minor version differs by more than 1. This is the hard mismatch path (res == 2) as opposed to the 'slight' (res == 1) or 'no settings' (res == 3) cases.","commonSituations":"Inserting signatures generated under a different BSim configuration or a different major Ghidra version than the database was built with. Pointing an ingest job at the wrong database. Mixing signatures from a different BSim deployment into an existing database.","solutions":["Align the signature-generation configuration and Ghidra major version with the database's recorded settings (read from the exception's formatted version strings).","If the database is the stale side, rebuild it from the current signature set so settings match.","Verify the target database URL/instance is the one matching your signature pipeline.","Do not mix signatures from different BSim configurations into one database."],"exampleFix":"// before\n// Inserting signatures (settings 0x06, major 1.1) into db (settings 0x05, major 1.2)\nFunctionDatabase.checkSettingsForInsert(manage, info);\n// after\n// Regenerate signatures with the db's exact configuration, or rebuild the db\nFunctionDatabase.checkSettingsForInsert(manage, info);","handlingStrategy":"validation","validationCode":"// Pre-check for hard settings/version mismatch before insert\nint res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings());\nif (res == 2) {\n    throw new IllegalStateException(String.format(\n        \"Hard settings mismatch: payload %d.%d:0x%02x vs db %d.%d:0x%02x\",\n        manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings(),\n        info.major, info.minor, info.settings));\n}\nFunctionDatabase.checkSettingsForInsert(manage, info);","typeGuard":null,"tryCatchPattern":"try {\n    FunctionDatabase.checkSettingsForInsert(manage, info);\n} catch (LSHException e) {\n    if (e.getMessage().contains(\"don't match database\")) {\n        log.error(\"Hard settings mismatch on insert; align configuration or rebuild db\", e);\n    }\n    throw e;\n}","preventionTips":["Use one BSim configuration and one major Ghidra version for a given database's lifetime.","Verify the target database matches your signature pipeline before bulk insert.","Never mix signatures from different BSim deployments into one database."],"tags":["bsim","signature-insert","version-mismatch","signature-settings"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}