NationalSecurityAgency/ghidra · error · LSHException

Trying to insert signature data with settings that don't ma

Error message

Trying to insert signature data  with settings that don't match database 

What it means

Thrown by FunctionDatabase.checkSettingsForInsert as the fallthrough case when checkSignatureSettings returns 2, meaning the insert payload's major version or settings value differ from the database (or minor versions differ by more than 1). BSim blocks the insert to keep the database's signature settings uniform and comparable.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/FunctionDatabase.java:255

		if (manage.numFunctions() == 0) {
			throw new DatabaseNonFatalException("Empty signature file");
		}
		int res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(),
			manage.getSettings());
		if (res == 0) {
			return false;
		}
		if (res == 1) {
			throw new LSHException(
				"Trying to insert signature data with slight differences in settings");
		}
		if (res == 4) {
			return true; // This apparently is the first insert
		}
		if (res == 3) {
			throw new LSHException("Trying to insert signature data with no setting information");
		}
		throw new LSHException("Trying to insert signature data " +
			getFormattedVersion(manage.getMajorVersion(), manage.getMinorVersion(),
				manage.getSettings()) +
			" with settings that don't match database " +
			getFormattedVersion(info.major, info.minor, info.settings));
	}

	public static String constructFatalError(int flags, ExecutableRecord newrec,
			ExecutableRecord orig) {
		String res = null;
		if ((flags & ExecutableRecord.METADATA_ARCH) != 0) {
			res = newrec.getNameExec() + " already ingested with different architecture field: " +
				orig.getArchitecture();
		}
		else if ((flags & ExecutableRecord.METADATA_COMP) != 0) {
			res = newrec.getNameExec() + " already ingested with different compiler field: " +
				orig.getNameCompiler();
		}
		else if ((flags & ExecutableRecord.METADATA_LIBR) != 0) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Align the signature-generation configuration and Ghidra major version with the database's recorded settings (read from the exception's formatted version strings).
  2. If the database is the stale side, rebuild it from the current signature set so settings match.
  3. Verify the target database URL/instance is the one matching your signature pipeline.
  4. Do not mix signatures from different BSim configurations into one database.

Example fix

// before
// Inserting signatures (settings 0x06, major 1.1) into db (settings 0x05, major 1.2)
FunctionDatabase.checkSettingsForInsert(manage, info);
// after
// Regenerate signatures with the db's exact configuration, or rebuild the db
FunctionDatabase.checkSettingsForInsert(manage, info);
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check for hard settings/version mismatch before insert
int res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings());
if (res == 2) {
    throw new IllegalStateException(String.format(
        "Hard settings mismatch: payload %d.%d:0x%02x vs db %d.%d:0x%02x",
        manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings(),
        info.major, info.minor, info.settings));
}
FunctionDatabase.checkSettingsForInsert(manage, info);

Try / catch

try {
    FunctionDatabase.checkSettingsForInsert(manage, info);
} catch (LSHException e) {
    if (e.getMessage().contains("don't match database")) {
        log.error("Hard settings mismatch on insert; align configuration or rebuild db", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Inserting signatures whose (major, settings) differ from the database, or whose minor version differs by more than 1. This is the hard mismatch path (res == 2) as opposed to the 'slight' (res == 1) or 'no settings' (res == 3) cases.

Common situations: Inserting signatures generated under a different BSim configuration or a different major Ghidra version than the database was built with. Pointing an ingest job at the wrong database. Mixing signatures from a different BSim deployment into an existing database.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/efd18213d1800c5f. Report an issue: GitHub.