NationalSecurityAgency/ghidra · error · LSHException

Bad characters in one or more proposed {type}

Error message

Bad characters in one or more proposed {type}

What it means

Thrown by checkStrings when any string in the provided list fails CategoryRecord.enforceTypeCharacters, which only allows letters, digits, space, '.', '_', ':', '/', '(', ')'. Null, empty, or strings with other characters (e.g., quotes, hyphens, '@', shell metacharacters) are rejected to keep category/tag names safe for SQL column names and XML.

Source

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

		}
		if (query.info.execats != null) {
			checkStrings(query.info.execats, "categories", -1);
			config.info.execats = query.info.execats;
		}
		generate(config);
		response.info = config.info;
	}

	private static void checkStrings(List<String> list, String type, int limit)
			throws LSHException {
		if (limit > 0 && list.size() > limit) {
			throw new LSHException("Too many " + type + " specified (limit=" +
				FunctionTagBSimFilterType.MAX_TAG_COUNT + "): " + list.size());
		}
		Set<String> names = new HashSet<>();
		for (String name : list) {
			if (!CategoryRecord.enforceTypeCharacters(name)) {
				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");

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Sanitize each name through a whitelist filter matching enforceTypeCharacters (alnum plus space . _ : / ( ) ) before submission.
  2. Replace disallowed characters (e.g., '-' to '_') in automated imports.
  3. Validate names client-side and reject invalid input before building the query.

Example fix

// before
query.info.functionTags = Arrays.asList("my-tag", "@special");
// after
static boolean validName(String s) {
    return CategoryRecord.enforceTypeCharacters(s);
}
query.info.functionTags = rawTags.stream()
    .filter(CategoryRecord::enforceTypeCharacters)
    .collect(Collectors.toList());
Defensive patterns

Strategy: validation

Validate before calling

for (String name : list) {
    if (!CategoryRecord.enforceTypeCharacters(name)) {
        throw new IllegalArgumentException("Invalid characters in: " + name);
    }
}

Prevention

When it happens

Trigger: Passing function tag or category names containing disallowed characters (dashes, asterisks, angle brackets, etc.) or null/empty strings in query.info.functionTags or query.info.execats during database creation or category installation.

Common situations: Importing tag names from external tooling that uses hyphens or special punctuation; user-supplied category names without sanitization; copy-pasting names with smart quotes or non-ASCII.

Related errors


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