NationalSecurityAgency/ghidra · error · LSHException

Bad characters in proposed function tag

Error message

Bad characters in proposed function tag

What it means

Thrown by fdbInstallTag when query.tag_name fails CategoryRecord.enforceTypeCharacters. Function tag names become bitmask column identifiers, so they must contain only letters, digits, space, '.', '_', ':', '/', '(', ')'. Null or empty names also fail.

Source

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

	/**
	 * Returns a list of all function tags in the database.
	 * 
	 * @return list of function tags
	 */
	public List<String> getFunctionTags() {
		return info.functionTags;
	}

	/**
	 * Entry point for the InstallTagRequest command
	 * @param query the install query to execute
	 * @throws LSHException if the function tag already exists or is not valid
	 * @throws SQLException if there is an error issuing the query
	 */
	private void fdbInstallTag(InstallTagRequest query) throws LSHException, SQLException {
		ResponseInfo response = query.installresponse;
		if (!CategoryRecord.enforceTypeCharacters(query.tag_name)) {
			throw new LSHException("Bad characters in proposed function tag");
		}
		// Check for existing tag
		if (info.functionTags != null) {
			if (info.functionTags.contains(query.tag_name)) {
				throw new LSHException("Function tag already exists");
			}
		}
		if (info.functionTags == null) {
			info.functionTags = new ArrayList<>();
		}
		// There are only 32-bits of space in the function record reserved for storing the presence of tags
		if (info.functionTags.size() >= FunctionTagBSimFilterType.MAX_TAG_COUNT) {
			throw new LSHException(
				"Cannot allocate new function tag: " + query.tag_name + " - Column space is full");
		}
		info.functionTags.add(query.tag_name);
		keyValueTable.writeFunctionTags(info);
		response.info = info;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Validate tag_name with CategoryRecord.enforceTypeCharacters before submitting.
  2. Sanitize by replacing disallowed characters with allowed alternatives.
  3. Reject null/empty tag names early.

Example fix

// before
req.tag_name = "my@tag";
// after
if (!CategoryRecord.enforceTypeCharacters(req.tag_name)) {
    req.tag_name = req.tag_name.replaceAll("[^\\w. :/()]", "_");
}
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Issuing an InstallTagRequest with a tag_name containing disallowed characters or that is null/empty.

Common situations: Importing tags from external systems with punctuation; user-entered tag names with hyphens or special symbols; programmatic tag generation producing reserved characters.

Related errors


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