{"record":{"id":"9da51d1a3294c37c","repo":"NationalSecurityAgency/ghidra","slug":"trying-to-insert-signature-data-with-no-setting-in","errorCode":null,"errorMessage":"Trying to insert signature data with no setting information","messagePattern":"Trying to insert signature data with no setting information","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java","lineNumber":253,"sourceCode":"\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;\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();","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java#L235-L271","documentation":"Thrown by FunctionDatabase.checkSettingsForInsert when checkSignatureSettings returns 3, meaning the insert payload itself has no setting information (its major version is 0 or its settings value is 0). BSim rejects inserting signatures that carry no settings metadata because they could not be validated against or consistently merged into the database.","triggerScenarios":"Inserting a signature file whose major version or settings field is 0. This happens when signatures were generated without a properly configured LSHVectorFactory (settings left at 0), or the file's header metadata is missing/corrupt.","commonSituations":"Generating signatures before calling setVectorFactory with a valid factory (factory.getSettings()==0). Loading a signature file produced by an incomplete or older export tool. A truncated file where the settings header was not written.","solutions":["Ensure GenSignatures.setVectorFactory is called with a factory whose getSettings() is non-zero before generating signatures (see error 730).","Regenerate the signature file with current BSim tooling so the header carries a non-zero major version and settings.","Inspect the file header to confirm the version/settings fields are populated."],"exampleFix":"// before\n// factory.getSettings() == 0 when generating\nFunctionDatabase.checkSettingsForInsert(manage, info);\n// after\ngenSignatures.setVectorFactory(vectorFactory); // getSettings() != 0\n// regenerate, then insert\nFunctionDatabase.checkSettingsForInsert(manage, info);","handlingStrategy":"validation","validationCode":"// Ensure insert payload has settings metadata\nif (manage.getMajorVersion() == 0 || manage.getSettings() == 0) {\n    throw new IllegalStateException(\n        \"Signature payload has no setting information; regenerate with an initialized vector factory\");\n}\nFunctionDatabase.checkSettingsForInsert(manage, info);","typeGuard":null,"tryCatchPattern":"try {\n    FunctionDatabase.checkSettingsForInsert(manage, info);\n} catch (LSHException e) {\n    if (e.getMessage().contains(\"no setting information\")) {\n        log.error(\"Insert payload lacks settings; factory not initialized\", e);\n    }\n    throw e;\n}","preventionTips":["Always initialize the LSHVectorFactory from a loaded configuration before generating signatures.","Validate the signature file header has non-zero major version and settings after loading.","Guard setVectorFactory against a zero-settings factory (see error 730)."],"tags":["bsim","signature-insert","signature-settings","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}