NationalSecurityAgency/ghidra · error · ParseException
%s: %s
Error message
%s: %s
What it means
Thrown as ParseException by OptType.decode(Location, String) as a catch-all wrapper when the underlying type-specific decode(str) raises any Exception. It prefixes the error with the source location (file:line) and appends the inner exception's message, so the real cause is visible (e.g., a bad int, bool, or path value).
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java:136
}
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()));
}
}
LaunchParameter<T> createParameter(String name, String display, String description,
boolean required, ValStr<T> defaultValue);
}
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;
};View on GitHub (pinned to d5f144c24d)
Solutions
- Read the inner message after the location prefix — it names the exact decode problem (see errors 355/356 for int/bool specifics).
- Correct the offending value in the launcher script's @attribute declaration to match the declared type.
- If the value is user-supplied at runtime, validate it against the type before launching.
Example fix
# before #@env PORT:int=0xZZ # decode fails -> 'file:line: Invalid int ...' # after #@env PORT:int=0x1F90
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate the default value against its type before parsing the script
try { type.decode(defaultValueStr); }
catch (Exception e) { /* report which parameter defaulted badly */ } Try / catch
try { OptType.parse(loc, typeName, userEnums); }
catch (ParseException e) {
// e.getMessage() is 'file:line: <inner detail>' — log and skip the parameter
} Prevention
- Test-launch launcher scripts after editing @attribute lines.
- Keep a linter that decodes each default value against its declared type.
- Read the inner message (after the location) to find the root decode error.
When it happens
Trigger: Providing a default or user-supplied value for a launcher parameter that fails type-specific decoding: a malformed integer, a non-bool string, or a path that throws. The Location identifies which parameter declaration is at fault.
Common situations: A launcher script declares '@env PORT:int=0xZZ' (bad hex); '@env FLAG:bool=yes' (not true/false); a default value with a stray character; a copy-paste error in the attribute line.
Related errors
- %s: Invalid type %s
- %s: Invalid base type %s
- Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed.
- Invalid bool for %s: %s. Only true or false is allowed.
- Transaction already started
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/6de6193d8d22b227.
Report an issue: GitHub.