NationalSecurityAgency/ghidra · error · LSHException

Bad characters in proposed category type

Error message

Bad characters in proposed category type

What it means

Thrown by fdbInstallCategory when query.type_name fails CategoryRecord.enforceTypeCharacters (only alnum, space, '.', '_', ':', '/', '(', ')' allowed). The category type name is used as a SQL column identifier and stored in XML, so invalid characters are rejected before any write occurs.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java:2185

				throw new LSHException("Bad characters in one or more proposed " + type);
			}
			if (!names.add(name)) {
				throw new LSHException("Duplicate " + type + " entry specified: " + name);
			}
		}
	}

	/**
	 * Entry point for the InstallCategoryRequest command
	 * @param query the query to execute
	 * @throws LSHException if the category is invalid or already exists
	 * @throws SQLException if there is an error issuing the query
	 */
	private void fdbInstallCategory(InstallCategoryRequest query)
			throws LSHException, SQLException {
		ResponseInfo response = query.installresponse;
		if (!CategoryRecord.enforceTypeCharacters(query.type_name)) {
			throw new LSHException("Bad characters in proposed category type");
		}
		if (query.isdatecolumn) {
			info.dateColumnName = query.type_name;
			keyValueTable.insert("datecolumn", info.dateColumnName);
			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<>();
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Validate query.type_name with CategoryRecord.enforceTypeCharacters before issuing the InstallCategoryRequest.
  2. Normalize the name: strip or replace disallowed characters (e.g., '-' to '_').
  3. Reject null/empty type_name early in the calling code.

Example fix

// before
req.type_name = "compiler-version"; // hyphen rejected
// after
if (!CategoryRecord.enforceTypeCharacters(req.type_name)) {
    req.type_name = req.type_name.replace('-', '_'); // "compiler_version"
}
Defensive patterns

Strategy: validation

Validate before calling

if (!CategoryRecord.enforceTypeCharacters(req.type_name)) {
    throw new IllegalArgumentException("Invalid category name: " + req.type_name);
}

Prevention

When it happens

Trigger: Submitting an InstallCategoryRequest whose type_name is null, empty, or contains characters outside the allowed set (hyphens, quotes, semicolons, etc.).

Common situations: Programmatic category creation from external metadata containing punctuation; user-typed category names without validation; importing schema labels with reserved SQL characters.

Related errors


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