NationalSecurityAgency/ghidra · error · IllegalArgumentException

Invalid min: {min}

Error message

Invalid min: {min}

What it means

FieldSpan.Domain.closed requires the min endpoint to be a valid lower bound. In the End API, POS_INF (positive infinity) returns isValidMin()==false because nothing can be greater-than-or-equal to +inf as a lower bound, so passing it as the min makes an impossible span and IllegalArgumentException is thrown.

Source

Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/FieldSpan.java:117

	 */
	static FieldSpan tail(Field from, boolean fromInclusive, Direction direction) {
		return direction == Direction.FORWARD
				? 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

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use a finite End or NEG_INF for the min endpoint.
  2. Validate isValidMin()/isValidMax() before calling closed() in generic code.
  3. Reorder inverted bounds before constructing the span.

Example fix

// before
span = domain.closed(End.POS_INF, someMax);
// after
span = domain.closed(aFiniteOrNegInfMin, someMax);
Defensive patterns

Strategy: validation

Validate before calling

if (!min.isValidMin()) {
    // swap in a finite or NEG_INF min before constructing the span
    return;
}

Prevention

When it happens

Trigger: closed(POS_INF, ...) or any min endpoint whose isValidMin() returns false (the framework's only such builtin endpoint is positive infinity).

Common situations: Generic span construction that lets the wrong infinity leak into the min slot; building ranges from inverted/unbounded bounds; programmatic min/max computation returning +inf for the lower end.

Related errors


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