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<>() {
@OverrideView on GitHub (pinned to d5f144c24d)
Solutions
- Use one of: str, int, bool, path, dir, file.
- If an enum was intended, use the OptType.parse path (error 352) instead, which accepts user enums.
- 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
- Use only the six base type keywords where a base type is required.
- Reserve enum names for OptType.parse contexts, not BaseType.parse.
- Lint for type-name typos.
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
- %s: Invalid type %s
- %s: %s
- Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed.
- Invalid bool for %s: %s. Only true or false is allowed.
- Type errors: {typeErrors}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/8f76caefff89f327.
Report an issue: GitHub.