NationalSecurityAgency/ghidra · warning · LSHException

Executable category already exists

Error message

Executable category already exists

What it means

fdbInstallCategory iterates info.execats; if query.type_name already equals an installed category it throws LSHException("Executable category already exists") without modifying the database.

Solutions

  1. Check existing categories before installing (or treat the 'already exists' outcome as success).
  2. Choose a different, unique category name.
  3. Drop then reinstall if a rename is required.

Example fix

// before
installCategory(db, name); // throws on re-run
// after
if (!db.getInfo().execats.contains(name)) {
    installCategory(db, name);
}
Defensive patterns

Strategy: validation

Validate before calling

List<String> existing = db.getInfo().execats != null ? db.getInfo().execats : List.of();
if (existing.contains(name)) return; // idempotent skip

Type guard

boolean alreadyInstalled = db.getInfo().execats != null && db.getInfo().execats.contains(name);

Try / catch

try { db.installCategory(req); }
catch (LSHException e) {
    if (e.getMessage().equals("Executable category already exists")) return;
    throw e;
}

Prevention

When it happens

Trigger: Calling InstallCategory for a category name that is already registered in the database.

Common situations: Re-running a setup/install script; an idempotent installer that does not check existence first.

Related errors


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

Appendix: source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java:2936

		if (!CategoryRecord.enforceTypeCharacters(query.type_name)) {
			throw new LSHException("Bad characters in proposed category type");
		}
		if (query.isdatecolumn) {
			info.dateColumnName = query.type_name;
			StringBuilder buffer = new StringBuilder();
			buffer.append("{ \"type\": \"keyvalue\", \"value\": \"")
					.append(info.dateColumnName)
					.append("\" }");
			connection.executeStatementNoResponse(ElasticConnection.PUT, "configuration/datecolumn",
				buffer.toString());
			response.info = info;
			return;
		}
		// Check for existing category
		if (info.execats != null) {
			for (String cat : info.execats) {
				if (cat.equals(query.type_name)) {
					throw new LSHException("Executable category already exists");
				}
			}
		}
		if (info.execats == null) {
			info.execats = new ArrayList<>();
		}
		info.execats.add(query.type_name);
		writeExecutableCategories();
		response.info = info;
	}

	/**
	 * Entry point for the Elasticsearch version of InstallTagRequest command:
	 *   Install a new function tag to be managed by this data
	 * @param query is command parameters
	 * @throws LSHException if the command is misconfigured
	 * @throws ElasticException for communication problems with the server
	 */

View on GitHub (pinned to d5f144c24d)