{"record":{"id":"b52f6b805622cd39","repo":"NationalSecurityAgency/ghidra","slug":"program-signature-generation-failure-e-getmessag","errorCode":null,"errorMessage":"Program signature generation failure: {e.getMessage()}","messagePattern":"Program signature generation failure: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java","lineNumber":1110,"sourceCode":"\t\t\t\tgensig.setVectorFactory(vectorFactory);\n\t\t\t\tgensig.addExecutableCategories(info.execats);\n\t\t\t\tgensig.addFunctionTags(info.functionTags);\n\t\t\t\tgensig.addDateColumnName(info.dateColumnName);\n\t\t\t\tMsg.info(this, \"Generating metadata for: \" + program.getDomainFile().getName());\n\t\t\t\tString path = GenSignatures.getPathFromDomainFile(program);\n\t\t\t\tgensig.openProgram(program, null, null, null, repo, path);\n\t\t\t\tgensig.scanFunctionsMetadata(null, null);\n\t\t\t\tDescriptionManager manager = gensig.getDescriptionManager();\n\t\t\t\tif (manager.numFunctions() == 0) {\n\t\t\t\t\tMsg.warn(this,\n\t\t\t\t\t\tprogram.getDomainFile().getName() + \" contains no functions with bodies\");\n\t\t\t\t}\n\t\t\t\ttry (FileWriter fwrite = new FileWriter(file)) {\n\t\t\t\t\tmanager.saveXml(fwrite);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (LSHException e) {\n\t\t\t\tthrow new IOException(\"Program signature generation failure: \" + e.getMessage());\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate class SignatureRepository extends IterateRepository {\n\n\t\tprivate File outdirectory;\n\t\tprivate String repo; // Repository URL to include with signature metadata\n\t\tprivate boolean overwrite; // True if existing signature files should be overwritten\n\t\tprivate DatabaseInformation info; // Database configuration (may affect signature generation)\n\t\tprivate LSHVectorFactory vectorFactory;\n\n\t\tpublic SignatureRepository(File outdir, String rp, boolean owrite, DatabaseInformation i,\n\t\t\t\tLSHVectorFactory vFactory) {\n\t\t\toutdirectory = outdir;\n\t\t\trepo = rp;\n\t\t\toverwrite = owrite;\n\t\t\tinfo = i;","sourceCodeStart":1092,"sourceCodeEnd":1128,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java#L1092-L1128","documentation":"Thrown by UpdateRepository.process when GenSignatures throws an LSHException during metadata generation for a program. The original LSHException is caught and re-wrapped as an IOException with a 'Program signature generation failure' prefix. This is the metadata-only path (scanFunctionsMetadata), used for updates rather than full signature generation.","triggerScenarios":"GenSignatures.openProgram or scanFunctionsMetadata fails with an LSHException — the program may have an unsupported processor/language, missing analysis, or the vector factory configuration may be incompatible. The UpdateRepository is iterating over programs in a Ghidra repository and generating metadata files.","commonSituations":"A program in the repository has an unsupported processor or was not fully analyzed; the BSim configuration's weight vector or language setting doesn't match the program's architecture; the program file is corrupted; the decompiler or function body extraction failed for all functions.","solutions":["Open the specific program in the Ghidra GUI and verify analysis completed successfully.","Check that the program's processor/language is supported by the BSim configuration (weight file, language module).","Run auto-analysis on the program before signature generation.","Inspect the original LSHException message (it is in the IOException message after the prefix) for the specific cause."],"exampleFix":"// before\ncatch (LSHException e) {\n    throw new IOException(\"Program signature generation failure: \" + e.getMessage());\n}\n\n// after — include program name and preserve cause\ncatch (LSHException e) {\n    throw new IOException(\"Signature generation failed for \" +\n        program.getDomainFile().getName() + \": \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// Verify the program is analyzed and has functions before signature generation\nFunctionManager fman = program.getFunctionManager();\nif (fman.getFunctionCount() == 0) {\n    throw new IllegalStateException(\n        \"Program has no functions: \" + program.getName() +\n        \". Run auto-analysis first.\");\n}\n// Verify the processor is supported by checking against the weight configuration","typeGuard":"public static boolean isProgramReadyForSignatures(Program program) {\n    return program != null &&\n        program.getFunctionManager().getFunctionCount() > 0 &&\n        program.getLanguage() != null;\n}","tryCatchPattern":"try {\n    updateRepo.process(program, monitor);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Program signature generation failure\")) {\n        // Log the program that failed and continue with remaining programs\n        Msg.error(this, \"Skipping \" + program.getName() + \": \" + e.getMessage());\n        continue; // in a repository iteration loop\n    }\n    throw e;\n}","preventionTips":["Run Ghidra auto-analysis (including function identification) before signature generation.","Verify the BSim weight configuration supports the program's processor/language.","Test signature generation on individual programs before batch processing.","Preserve the original LSHException as a cause in the IOException for diagnosis."],"tags":["bsim","signature-generation","update-repository","decompile"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}