NationalSecurityAgency/ghidra · error · LSHException
Cannot have signature setting of 0
Error message
Cannot have signature setting of 0
What it means
Thrown by GenSignatures.setVectorFactory when the provided LSHVectorFactory reports a settings value of 0 (vFactory.getSettings() == 0). The settings value encodes the signature-generation configuration (weights, hashing); zero means the factory was never properly initialized, so BSim refuses to use it to avoid generating unusable signatures.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/GenSignatures.java:117
public void addFunctionTags(List<String> names) {
if (names == null) {
return;
}
int flag = 1;
flag <<= FunctionTagBSimFilterType.RESERVED_BITS; // The first bits are reserved
for (String name : names) {
if ((flag == 0) || (!CategoryRecord.enforceTypeCharacters(name))) {
throw new IllegalArgumentException();
}
attributes.put(name, flag);
flag <<= 1;
}
}
public void setVectorFactory(LSHVectorFactory vFactory) throws LSHException {
if (vFactory.getSettings() == 0) {
throw new LSHException("Cannot have signature setting of 0");
}
if (vectorFactory == vFactory) { // No change to factory
return;
}
if (manager != null) {
manager.clearFunctions(); // Clear out cached signature as settings have changed
}
vectorFactory = vFactory;
}
public void addDateColumnName(String name) {
if (name == null) {
return;
}
if (!CategoryRecord.enforceTypeCharacters(name)) {
throw new IllegalArgumentException();
}
dateColumnName = name;View on GitHub (pinned to d5f144c24d)
Solutions
- Initialize the vector factory from a valid configuration before assigning it: load settings/weights so getSettings() is non-zero.
- Use FunctionDatabase.generateLSHVectorFactory() plus a loaded Configuration to set up the factory properly.
- Verify factory.getSettings() != 0 in a guard before calling setVectorFactory.
Example fix
// before LSHVectorFactory factory = new WeightedLSHCosineVectorFactory(); // settings == 0 genSignatures.setVectorFactory(factory); // after WeightedLSHCosineVectorFactory factory = FunctionDatabase.generateLSHVectorFactory(); factory.setSettings(configuration); // loads non-zero settings genSignatures.setVectorFactory(factory);
Defensive patterns
Strategy: validation
Validate before calling
// Guard against a zero-settings vector factory
LSHVectorFactory factory = FunctionDatabase.generateLSHVectorFactory();
// ... initialize factory from a Configuration so settings are loaded ...
if (factory.getSettings() == 0) {
throw new IllegalStateException(
"Vector factory has settings == 0; configuration was not loaded");
}
genSignatures.setVectorFactory(factory); Try / catch
try {
genSignatures.setVectorFactory(factory);
} catch (LSHException e) {
if (e.getMessage().contains("signature setting of 0")) {
log.error("Vector factory not initialized; load a configuration first", e);
}
throw e;
} Prevention
- Always initialize the vector factory from a loaded Configuration before assigning it.
- Assert factory.getSettings() != 0 in a helper that wires up GenSignatures.
- Unit-test the factory initialization path so a regression that zeroes settings is caught.
When it happens
Trigger: Calling genSignatures.setVectorFactory(factory) where factory.getSettings() returns 0. This happens when a WeightedLSHCosineVectorFactory is constructed but its settings were never loaded from a configuration/weight file.
Common situations: Creating a vector factory manually without loading weights/settings. Loading a configuration failed silently or was skipped before assigning the factory. Using a freshly-constructed factory that has not been initialized via the configuration template.
Related errors
- Invalid in URL
- Query signature data has no setting information
- Trying to insert signature data with no setting information
- drop database name must match
- Too many {type} specified (limit={MAX_TAG_COUNT}): {list.siz
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/97854868f857babf.
Report an issue: GitHub.