{"record":{"id":"fcf053b40009f2b0","repo":"NationalSecurityAgency/ghidra","slug":"empty-signature-file","errorCode":null,"errorMessage":"Empty signature file","messagePattern":"Empty signature file","errorType":"exception","errorClass":"DatabaseNonFatalException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java","lineNumber":238,"sourceCode":"\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) {\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(),","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java#L220-L256","documentation":"Thrown by FunctionDatabase.checkSettingsForInsert as a DatabaseNonFatalException when the signature file being inserted contains zero functions (manage.numFunctions() == 0). BSim treats an empty signature payload as a non-fatal insertion error so a bulk ingest can skip the file and continue with others, rather than aborting the whole operation.","triggerScenarios":"Calling checkSettingsForInsert with a DescriptionManager that has no loaded functions. This occurs when a signature-generation step produced no functions (e.g. the program had none, or filtering removed all of them) and the resulting file is then submitted for insertion.","commonSituations":"Running BSim ingest on a program with no recognized functions. Applying a filter (address range, category, exclude list) that eliminates all functions. A decompiler failure that silently produced an empty output file. Submitting an accidentally-created empty .gsim file.","solutions":["Verify the source program actually contains functions before generating signatures (check getFunctionManager().getFunctionCount()).","Loosen or remove filters (address ranges, category exclusions) that may be stripping out all functions.","Check the decompile log for earlier errors that produced no signatures.","Skip empty files in the ingest loop since this is a non-fatal, skippable condition."],"exampleFix":"// before\nif (manage.numFunctions() == 0) { /* still attempt insert */ }\nFunctionDatabase.checkSettingsForInsert(manage, info);\n// after\nif (manage.numFunctions() == 0) {\n    log.warn(\"Skipping empty signature file\");\n    continue;\n}\nFunctionDatabase.checkSettingsForInsert(manage, info);","handlingStrategy":"try-catch","validationCode":"// Skip empty signature files before insert\nif (manage.numFunctions() == 0) {\n    log.warn(\"Skipping empty signature file during ingest\");\n    // skip this file in the ingest loop\n} else {\n    FunctionDatabase.checkSettingsForInsert(manage, info);\n}","typeGuard":null,"tryCatchPattern":"try {\n    FunctionDatabase.checkSettingsForInsert(manage, info);\n} catch (DatabaseNonFatalException e) {\n    if (e.getMessage().equals(\"Empty signature file\")) {\n        log.warn(\"Empty signature file skipped: {}\", sourceFile);\n        continue; // non-fatal, move to next file in ingest loop\n    }\n    throw e;\n}","preventionTips":["Check manage.numFunctions() > 0 before attempting insert.","During bulk ingest, catch DatabaseNonFatalException per-file and continue.","Log the source program/file for each empty payload so you can investigate why no functions were produced."],"tags":["bsim","signature-insert","empty-data","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}