NationalSecurityAgency/ghidra · error · ParseException

%s: Invalid type %s

Error message

%s: Invalid type %s

What it means

Thrown as ParseException by OptType.parse when a declared type name is neither a recognized base type (str/int/bool/path/dir/file) nor a key in the userEnums map. This occurs while parsing the @attribute type declarations of a launcher script, so it surfaces at launcher-parameter schema build time.

Source

Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java:120

		}
	}

	protected record Location(String fileName, int lineNo) {
		@Override
		public String toString() {
			return "%s:%d".formatted(fileName, lineNo);
		}
	}

	protected interface OptType<T> extends ValStr.Decoder<T> {
		static OptType<?> parse(Location loc, String typeName, Map<String, UserType<?>> userEnums)
				throws ParseException {
			OptType<?> type = BaseType.parseNoErr(typeName);
			if (type == null) {
				type = userEnums.get(typeName);
			}
			if (type == null) { // still
				throw new ParseException(loc, "%s: Invalid type %s".formatted(loc, typeName));
			}
			return type;
		}

		default TypeAndDefault<T> withCastDefault(ValStr<Object> defaultValue) {
			return new TypeAndDefault<>(this, ValStr.cast(cls(), defaultValue));
		}

		Class<T> cls();

		default T decode(Location loc, String str) throws ParseException {
			try {
				return decode(str);
			}
			catch (Exception e) {
				throw new ParseException(loc, "%s: %s".formatted(loc, e.getMessage()));
			}
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use one of the valid base types: str, int, bool, path, dir, file.
  2. If a custom enum is intended, ensure it is declared as a user enum earlier in the script before referencing it.
  3. Check for typos in the type name — it is case-sensitive.

Example fix

# before
#@env COUNT:integer=5   # 'integer' is invalid

# after
#@env COUNT:int=5
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Set.of("str","int","bool","path","dir","file");
if (!valid.contains(typeName) && !userEnums.containsKey(typeName)) {
    throw new ParseException(loc, "Unknown type: " + typeName);
}

Type guard

boolean isValidTypeName(String t, Set<String> userEnumNames) {
    return Set.of("str","int","bool","path","dir","file").contains(t) || userEnumNames.contains(t);
}

Prevention

When it happens

Trigger: A launcher script declares a parameter with a type like '@env TYPE=mytype' where 'mytype' is not one of the six base types and was not declared as a user enum earlier in the same script. The parser exhausts both base-type and enum lookups and rejects the declaration.

Common situations: Typo in the type keyword (e.g., 'integer' instead of 'int', 'string' instead of 'str'); referencing an enum name that was never declared; a script edited by hand introducing an invalid type; version skew where a new type name was expected but isn't supported by this parser.

Related errors


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