{"record":{"id":"85a00406509298f7","repo":"NationalSecurityAgency/ghidra","slug":"trying-to-insert-signature-data-with-slight-differ","errorCode":null,"errorMessage":"Trying to insert signature data with slight differences in settings","messagePattern":"Trying to insert signature data with slight differences in settings","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java","lineNumber":246,"sourceCode":"\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) {\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;","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java#L228-L264","documentation":"Thrown by FunctionDatabase.checkSettingsForInsert when checkSignatureSettings returns 1, meaning the query/insert payload's settings match the database except for a minor version difference of exactly 1. BSim refuses even this 'slight' difference on insert to keep the database's signature settings strictly uniform, because mixing minor variants would degrade similarity scoring consistency.","triggerScenarios":"Inserting signatures whose (major, settings) match the database but whose minor version is exactly 1 away (minor - min == 1 or min - minor == 1). The factory/decompiler minor version drifts by one revision between the database build and the insert.","commonSituations":"A patch-level Ghidra update bumped the decompiler minor version. Generating new signatures on a slightly newer build and inserting into an existing database. Different developers using point-release versions of Ghidra against the same shared BSim database.","solutions":["Regenerate the insert signatures with the exact same Ghidra version used to build the database (matching minor version).","If a consistent minor drift is unavoidable, rebuild the BSim database from scratch with the current version so all entries share one minor version.","Standardize the Ghidra version across all contributors writing to the shared database."],"exampleFix":"// before\n// Inserting signatures from Ghidra 11.0.1 into a db built with 11.0.2 (minor differs by 1)\nFunctionDatabase.checkSettingsForInsert(manage, info);\n// after\n// Rebuild db or regenerate signatures so minor versions match exactly\nFunctionDatabase.checkSettingsForInsert(manage, info);","handlingStrategy":"validation","validationCode":"// Pre-check for slight (minor-only) version drift before insert\nint res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings());\nif (res == 1) {\n    throw new IllegalStateException(String.format(\n        \"Slight settings drift: query %d.%d vs db %d.%d; regenerate signatures to match exactly\",\n        manage.getMajorVersion(), manage.getMinorVersion(), info.major, info.minor));\n}\nFunctionDatabase.checkSettingsForInsert(manage, info);","typeGuard":null,"tryCatchPattern":"try {\n    FunctionDatabase.checkSettingsForInsert(manage, info);\n} catch (LSHException e) {\n    if (e.getMessage().contains(\"slight differences\")) {\n        log.error(\"Minor version drift on insert; standardize the Ghidra version\", e);\n    }\n    throw e;\n}","preventionTips":["Standardize the exact Ghidra point release across all contributors writing to the database.","Rebuild the database if a minor-version drift becomes unavoidable.","Log the (major,minor,settings) of both sides on every insert for auditability."],"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"}