{"record":{"id":"916a3320a2566b3e","repo":"NationalSecurityAgency/ghidra","slug":"e-getmessage","errorCode":null,"errorMessage":"${e.getMessage()}","messagePattern":"\\$\\{e\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"QueryDatabaseException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SimilarFunctionQueryService.java","lineNumber":77,"sourceCode":"\t * server.  This involves generating the signatures for each of the function and accumulating their\n\t * FunctionDescriptions\n\t * @param queryInfo   is the high-level form of query, with the list of FunctionSymbols and other parameters\n\t * @param monitor the task monitor\n\t * @return the QueryNearest object ready for the queryStaged method\n\t * @throws QueryDatabaseException if transferring functions fails\n\t */\n\tpublic QueryNearest generateQueryNearest(SFQueryInfo queryInfo, TaskMonitor monitor)\n\t\t\tthrows QueryDatabaseException {\n\t\tQueryNearest result = queryInfo.buildQueryNearest();\n\t\tdoSignatureGeneration(queryInfo.getFunctions(), monitor);\n\t\tFunctionSymbolIterator iter =\n\t\t\tnew FunctionSymbolIterator(queryInfo.getFunctions().iterator());\n\t\ttry {\n\t\t\tsignatureGenerator.transferCachedFunctions(result.manage, iter,\n\t\t\t\tqueryInfo.getPreFilter());\n\t\t}\n\t\tcatch (LSHException e) {\n\t\t\tthrow new QueryDatabaseException(e.getMessage());\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic QueryNearestVector generateQueryNearestVector(SFOverviewInfo overviewInfo,\n\t\t\tTaskMonitor monitor) throws QueryDatabaseException {\n\t\tQueryNearestVector result = overviewInfo.buildQueryNearestVector();\n\t\tdoSignatureGeneration(overviewInfo.getFunctions(), monitor);\n\t\tFunctionSymbolIterator iter =\n\t\t\tnew FunctionSymbolIterator(overviewInfo.getFunctions().iterator());\n\t\ttry {\n\t\t\tsignatureGenerator.transferCachedFunctions(result.manage, iter,\n\t\t\t\toverviewInfo.getPreFilter());\n\t\t}\n\t\tcatch (LSHException e) {\n\t\t\tthrow new QueryDatabaseException(e.getMessage());\n\t\t}\n\t\treturn result;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SimilarFunctionQueryService.java#L59-L95","documentation":"Thrown by SimilarFunctionQueryService.generateQueryNearest when signatureGenerator.transferCachedFunctions raises an LSHException while copying cached function signatures into the query's manage record. The facade wraps it into a QueryDatabaseException carrying only e.getMessage(). generateQueryNearest builds a QueryNearest request and pre-stages signatures before the network query.","triggerScenarios":"A signature-generation/transfer failure during query preparation: missing cached signature data for a selected function, a function that cannot be disassembled/hashed, or a pre-filter rejecting the function. The original LSHException detail is preserved only in the message string.","commonSituations":"Selected function lacks a body or signature (thunk/external); signature cache invalidated mid-run; program closed/modified between selection and query; preFilter configuration excludes the function.","solutions":["Ensure all selected functions have disassembled bodies and valid signatures before querying (analyze the program first).","Reopen/refresh the program if it was modified or closed since selection.","Inspect the wrapped LSHException message for the root cause; if you need the cause object, call the underlying signatureGenerator path directly rather than the facade.","Narrow the selection to functions known to have generated signatures."],"exampleFix":"// before\nQueryNearest q = service.generateQueryNearest(queryInfo, monitor);\n// after: ensure program analyzed, then surface cause\ntry {\n    QueryNearest q = service.generateQueryNeast(queryInfo, monitor);\n} catch (QueryDatabaseException e) {\n    log.warning(\"Signature transfer failed: \" + e.getMessage());\n}","handlingStrategy":"try-catch","validationCode":"// ensure every selected function is analyzed/has a signature\nfor (FunctionSymbol s : queryInfo.getFunctions()) {\n    if (s.getFunction() == null || s.getFunction().getBody().isEmpty()) {\n        throw new IllegalStateException(\"Function lacks body: \" + s.getName());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    QueryNearest q = service.generateQueryNearest(queryInfo, monitor);\n} catch (QueryDatabaseException e) {\n    log.warning(\"Signature staging failed: \" + e.getMessage());\n    // narrow selection to analyzable functions and retry\n}","preventionTips":["Analyze the program so all selected functions have bodies/signatures.","Do not modify or close the program between selection and query.","For the cause object, call the lower-level signature API directly instead of the facade wrapper."],"tags":["bsim","facade","signature-generation","wrapped-exception","query"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}