NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid max: {max}
Error message
Invalid max: {max} What it means
Symmetric to the min case: NEG_INF returns isValidMax()==false because nothing can be less-than-or-equal to -inf as an upper bound, so closed(..., NEG_INF) is impossible and IllegalArgumentException is thrown.
Source
Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/FieldSpan.java:120
? DOMAIN.closed(End.lower(from, fromInclusive), End.positiveInfinity())
: DOMAIN.closed(End.negativeInfinity(), End.upper(from, fromInclusive));
}
/**
* The domain of field values, allowing open endpoints
*/
public class Domain extends EndDomain<Field, FieldSpan> {
private Domain() {
super(Field::compareTo);
}
@Override
public FieldSpan closed(End<Field> min, End<Field> max) {
if (!min.isValidMin()) {
throw new IllegalArgumentException("Invalid min: " + min);
}
if (!max.isValidMax()) {
throw new IllegalArgumentException("Invalid max: " + max);
}
return super.closed(min, max);
}
@Override
public FieldSpan newSpan(End<Field> min, End<Field> max) {
return new Impl(min, max);
}
@Override
public FieldSpan empty() {
return EMPTY;
}
@Override
public FieldSpan all() {
return ALL;
}View on GitHub (pinned to d5f144c24d)
Solutions
- Use a finite End or POS_INF for the max endpoint.
- Validate isValidMax() before calling closed() in generic code.
- Ensure bounds are ordered min <= max before construction.
Example fix
// before span = domain.closed(someMin, End.NEG_INF); // after span = domain.closed(someMin, aFiniteOrPosInfMax);
Defensive patterns
Strategy: validation
Validate before calling
if (!max.isValidMax()) {
// swap in a finite or POS_INF max before constructing the span
return;
} Prevention
- Validate endpoints before closed() in generic range code.
- Never use NEG_INF as a maximum endpoint.
When it happens
Trigger: A max endpoint whose isValidMax() is false - the builtin case is NEG_INF used as the upper bound.
Common situations: Inverted bounds leaking negative infinity into the max slot; generic range builders that don't validate endpoints; min/max swapped during construction.
Related errors
- Invalid min: {min}
- Invalid number of elements specified: {}
- pos cannot be less than zero
- %s: unknown demangling style `%s'
- Max ascii string size is %d you provided: %lu chars. Exiting
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/b04ef70248db7b66.
Report an issue: GitHub.