NationalSecurityAgency/ghidra · error · ParseException

%s: Invalid base type %s

Error message

%s: Invalid base type %s

What it means

Thrown as ParseException by BaseType.parse when a type name is required to be a base type specifically (not an enum) and parseNoErr returns null. The accepted base types are str, int, bool, path, dir, file. This is stricter than error 352 which also considers user enums.

Source

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

	}

	protected interface BaseType<T> extends OptType<T> {
		public static BaseType<?> parseNoErr(String typeName) {
			return switch (typeName) {
				case "str" -> BaseType.STRING;
				case "int" -> BaseType.INT;
				case "bool" -> BaseType.BOOL;
				case "path" -> BaseType.PATH;
				case "dir" -> BaseType.DIR;
				case "file" -> BaseType.FILE;
				default -> null;
			};
		}

		public static BaseType<?> parse(Location loc, String typeName) throws ParseException {
			BaseType<?> type = parseNoErr(typeName);
			if (type == null) {
				throw new ParseException(loc, "%s: Invalid base type %s".formatted(loc, typeName));
			}
			return type;
		}

		public static final BaseType<String> STRING = new BaseType<>() {
			@Override
			public Class<String> cls() {
				return String.class;
			}

			@Override
			public String decode(String str) {
				return str;
			}
		};

		public static final BaseType<BigInteger> INT = new BaseType<>() {
			@Override

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use one of: str, int, bool, path, dir, file.
  2. If an enum was intended, use the OptType.parse path (error 352) instead, which accepts user enums.
  3. Check the type keyword spelling and case.

Example fix

# before
BaseType.parse(loc, "integer") // throws 'Invalid base type'

# after
BaseType.parse(loc, "int")
Defensive patterns

Strategy: validation

Validate before calling

Set<String> baseTypes = Set.of("str","int","bool","path","dir","file");
if (!baseTypes.contains(typeName)) throw new ParseException(loc, "Use a base type: " + baseTypes);

Type guard

boolean isBaseType(String t) {
    return Set.of("str","int","bool","path","dir","file").contains(t);
}

Prevention

When it happens

Trigger: Calling BaseType.parse for a context where only primitive/file types are permitted, with a name outside the six allowed. For example, an internal path that expects a concrete base type and receives an enum name or a typo.

Common situations: A launcher schema element mistakenly uses an enum name where a base type is required; typo in the type keyword; a code path that bypasses enum resolution and goes straight to BaseType.parse.

Related errors


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