NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid bool for %s: %s. Only true or false is allowed.
Error message
Invalid bool for %s: %s. Only true or false is allowed.
What it means
Thrown as IllegalArgumentException by the BOOL BaseType decoder when the trimmed, lower-cased input is neither 'true' nor 'false'. The decoder is strict: values like 1/0, yes/no, on/off are all rejected. The message names AT_ENV (the attribute token context). Usually surfaces wrapped by error 353's ParseException.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java:210
}
}
};
public static final BaseType<Boolean> BOOL = new BaseType<>() {
@Override
public Class<Boolean> cls() {
return Boolean.class;
}
@Override
public Boolean decode(String str) {
Boolean result = switch (str.trim().toLowerCase()) {
case "true" -> true;
case "false" -> false;
default -> null;
};
if (result == null) {
throw new IllegalArgumentException(
"Invalid bool for %s: %s. Only true or false is allowed."
.formatted(AT_ENV, str));
}
return result;
}
};
public static final BaseType<Path> PATH = new BaseType<>() {
@Override
public Class<Path> cls() {
return Path.class;
}
@Override
public Path decode(String str) {
return Paths.get(str);
}
};View on GitHub (pinned to d5f144c24d)
Solutions
- Use the literal 'true' or 'false' (case-insensitive) for bool parameters.
- Convert any 1/0, yes/no, on/off values to true/false before declaring them.
- Double-check the default value in the @attribute declaration line.
Example fix
# before #@env VERBOSE:bool=1 # throws 'Invalid bool ... Only true or false' # after #@env VERBOSE:bool=true
Defensive patterns
Strategy: validation
Validate before calling
String v = str.trim().toLowerCase();
if (!v.equals("true") && !v.equals("false")) {
throw new IllegalArgumentException("Bool must be true/false, got: " + str);
} Type guard
boolean isValidBool(String s) {
String v = s.trim().toLowerCase();
return v.equals("true") || v.equals("false");
} Prevention
- Use only 'true' or 'false' for bool parameters.
- Convert 1/0, yes/no, on/off values before declaring them.
- Remember the decoder trims and lower-cases, but accepts nothing else.
When it happens
Trigger: Declaring or supplying a bool parameter with a value such as '1', '0', 'yes', 'on', 'enabled', or an empty string. Only the literal words 'true' and 'false' (any case, with surrounding whitespace) pass.
Common situations: A script author used 1/0 or yes/no conventions common in other config formats; a template substituted a non-boolean; a copy from a properties file that uses 'on'/'off'.
Related errors
- %s: Invalid type %s
- %s: %s
- %s: Invalid base type %s
- Invalid int %s. Prefixes 0x, 0b, and 0 (octal) are allowed.
- Transaction already started
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/ffbefef7b826631c.
Report an issue: GitHub.