NationalSecurityAgency/ghidra · error · QueryDatabaseException
${e1.getMessage()}
Error message
${e1.getMessage()} What it means
Thrown as a QueryDatabaseException wrapping an LSHException when signatureGenerator.setVectorFactory(database.getLSHVectorFactory()) fails. The LSHVectorFactory obtained from the database cannot be applied to the GenSignatures generator, typically because the vector factory configurations are incompatible (different LSH parameters, weight tables, or vector dimensions).
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/facade/SimilarFunctionQueryService.java:472
return false;
}
return database.getURLString().equals(serverURLString);
}
private void doSignatureGeneration(Set<FunctionSymbol> functions, TaskMonitor monitor)
throws QueryDatabaseException {
if (functions.isEmpty()) {
return;
}
if (signatureGenerator == null) {
signatureGenerator = createSignatureGenerator();
}
try {
signatureGenerator.setVectorFactory(database.getLSHVectorFactory());
}
catch (LSHException e1) {
throw new QueryDatabaseException(e1);
}
monitor.setMessage("Hashing function signatures...");
FunctionSymbolIterator iter = new FunctionSymbolIterator(functions.iterator());
int count = functions.size();
try {
// TODO: do this work in a loop so that one failure doesn't stop the entire process...the
// downside is losing parallelization
signatureGenerator.scanFunctions(iter, count, monitor);
}
catch (DecompileException e) {
throw new QueryDatabaseException(e);
}
}
private GenSignatures createSignatureGenerator() throws QueryDatabaseException {
try {
GenSignatures newSignatureGenerator = new GenSignatures(false);View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the BSim weight configuration and LSH parameters used to generate signatures match those of the target database.
- Re-generate the program's signatures using the same BSim settings the database was built with.
- Check getDatabaseCompatibility() before calling generateSignatures to detect layout mismatches early.
- If the database is old, consider rebuilding it with the current Ghidra version's BSim settings.
Example fix
// before
String compat = service.getDatabaseCompatibility();
if (compat != null) {
// proceed anyway -> LSHException from setVectorFactory
service.generateSignatures(functions, monitor);
}
// after
String compat = service.getDatabaseCompatibility();
if (compat != null) {
Msg.showError(this, null, "BSim Incompatible", compat);
return;
}
service.generateSignatures(functions, monitor); Defensive patterns
Strategy: validation
Validate before calling
// Check layout compatibility before generating signatures
String compat = service.getDatabaseCompatibility();
if (compat != null) {
throw new IllegalStateException(
"Cannot generate signatures: " + compat);
} Try / catch
try {
service.generateSignatures(functions, monitor);
} catch (QueryDatabaseException e) {
if (e.getCause() instanceof LSHException) {
Msg.showError(this, null, "BSim Vector Mismatch",
"The program's BSim settings are incompatible with the database. " +
"Re-generate the database or use matching BSim weights.");
}
throw e;
} Prevention
- Always call getDatabaseCompatibility() and check for null before generating signatures.
- Ensure the BSim weight configuration used for the program matches the database.
- Document which BSim weight file was used to build each database.
- After upgrading Ghidra, check if BSim vector format changed before using old databases.
When it happens
Trigger: Occurs in doSignatureGeneration() when the signature generator (created from the local program) and the database's vector factory use mismatched LSH settings. This happens when the program's BSim weighting/layout differs from the database's — for example, the database was built with a different weight configuration file, or the client's BSim settings were changed after the program was loaded.
Common situations: Program was loaded with one BSim weight configuration, but the database uses a different one. The user changed BSim settings or upgraded Ghidra, altering the default LSH parameters. Cross-referencing a program against a database built by a different Ghidra version with incompatible vector factories.
Related errors
- Could not get MD5 on file:
- Could not get MD5 on file:
- Could not get MD5 on file:
- weighttable has wrong number of rows
- Missing tokenizer configuration
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/ca4684291ce2f943.
Report an issue: GitHub.