apache/iceberg · error · IllegalStateException
Invalid operation for BoundSetPredicate:
Error message
Invalid operation for BoundSetPredicate:
What it means
BoundSetPredicate.test() only supports the IN and NOT_IN operations. If the bound predicate carries any other operation, the switch falls through to default and throws IllegalStateException. This is an internal invariant violation: a BoundSetPredicate should only ever be constructed with IN or NOT_IN.
Solutions
- Only construct or rewrite BoundSetPredicate with Operation.IN or Operation.NOT_IN
- Check op() before invoking test() if operations may have been transformed
- Report a bug if triggered by stock Iceberg binding/evaluation
Example fix
// before
pred.asSetPredicate().test(value);
// after
if (pred.op() == Operation.IN || pred.op() == Operation.NOT_IN) {
pred.asSetPredicate().test(value);
} Defensive patterns
Strategy: validation
Validate before calling
if (pred.op() != Operation.IN && pred.op() != Operation.NOT_IN) { throw new IllegalArgumentException("BoundSetPredicate requires IN/NOT_IN"); } Type guard
boolean evaluableSet = p.op() == Operation.IN || p.op() == Operation.NOT_IN;
Try / catch
try { result = setPred.test(value); } catch (IllegalStateException e) { /* corrupt operation: log and fail fast */ } Prevention
- Never mutate op() on constructed predicates in custom rewrites
- Rebind expressions after transformation instead of patching operations
- Treat this as an internal bug if triggered by stock APIs
When it happens
Trigger: Evaluating a BoundSetPredicate whose op() is not IN/NOT_IN — practically only possible via corrupted construction, misuse of internal APIs, or a bug in a custom expression rewrite that changed the operation on a set predicate.
Common situations: Custom expression rewriting/transformation code that swaps operations on predicates without preserving the predicate class/operation pairing.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Invalid operation for BoundUnaryPredicate:
- AboveMax has no comparator
- BelowMin has no comparator
- BelowMin has no value
- Cannot change the type of BelowMin
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/4d7c90e6b4906373.
Report an issue: GitHub.
Appendix: source
Thrown at api/src/main/java/org/apache/iceberg/expressions/BoundSetPredicate.java:65
@Override
public BoundSetPredicate<T> asSetPredicate() {
return this;
}
public Set<T> literalSet() {
return literalSet;
}
@Override
public boolean test(T value) {
switch (op()) {
case IN:
return value != null && literalSet.contains(value);
case NOT_IN:
return value == null || !literalSet.contains(value);
default:
throw new IllegalStateException("Invalid operation for BoundSetPredicate: " + op());
}
}
@Override
public boolean isEquivalentTo(Expression other) {
// only check bound set predicate; binding will convert sets of a single item to a literal
// predicate
if (op() == other.op()) {
BoundSetPredicate<?> pred = (BoundSetPredicate<?>) other;
return literalSet().equals(pred.literalSet());
}
return false;
}
@Override
public String toString() {
switch (op()) {View on GitHub (pinned to 86d9c8fc54)