NationalSecurityAgency/ghidra · error · LSHException

Trying to insert signature data with slight differences in s

Error message

Trying to insert signature data with slight differences in settings

What it means

Thrown by FunctionDatabase.checkSettingsForInsert when checkSignatureSettings returns 1, meaning the query/insert payload's settings match the database except for a minor version difference of exactly 1. BSim refuses even this 'slight' difference on insert to keep the database's signature settings strictly uniform, because mixing minor variants would degrade similarity scoring consistency.

Source

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

			getFormattedVersion(info.major, info.minor, info.settings));
	}

	private static String getFormattedVersion(int maj, int min, int settings) {
		return String.format("%d.%d:0x%02x", maj, min, settings);
	}

	public static boolean checkSettingsForInsert(DescriptionManager manage,
			DatabaseInformation info) throws LSHException, DatabaseNonFatalException {
		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;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Regenerate the insert signatures with the exact same Ghidra version used to build the database (matching minor version).
  2. If a consistent minor drift is unavoidable, rebuild the BSim database from scratch with the current version so all entries share one minor version.
  3. Standardize the Ghidra version across all contributors writing to the shared database.

Example fix

// before
// Inserting signatures from Ghidra 11.0.1 into a db built with 11.0.2 (minor differs by 1)
FunctionDatabase.checkSettingsForInsert(manage, info);
// after
// Rebuild db or regenerate signatures so minor versions match exactly
FunctionDatabase.checkSettingsForInsert(manage, info);
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check for slight (minor-only) version drift before insert
int res = info.checkSignatureSettings(manage.getMajorVersion(), manage.getMinorVersion(), manage.getSettings());
if (res == 1) {
    throw new IllegalStateException(String.format(
        "Slight settings drift: query %d.%d vs db %d.%d; regenerate signatures to match exactly",
        manage.getMajorVersion(), manage.getMinorVersion(), info.major, info.minor));
}
FunctionDatabase.checkSettingsForInsert(manage, info);

Try / catch

try {
    FunctionDatabase.checkSettingsForInsert(manage, info);
} catch (LSHException e) {
    if (e.getMessage().contains("slight differences")) {
        log.error("Minor version drift on insert; standardize the Ghidra version", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Inserting signatures whose (major, settings) match the database but whose minor version is exactly 1 away (minor - min == 1 or min - minor == 1). The factory/decompiler minor version drifts by one revision between the database build and the insert.

Common situations: A patch-level Ghidra update bumped the decompiler minor version. Generating new signatures on a slightly newer build and inserting into an existing database. Different developers using point-release versions of Ghidra against the same shared BSim database.

Related errors


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