apache/iceberg · error · IllegalArgumentException

Unexpected null order

Error message

Unexpected null order: %s

What it means

Defensive default branch in NullOrder.toString's switch. Both enum constants (NULLS_FIRST, NULLS_LAST) are handled explicitly, so this can only fire if a new constant is added to the enum without updating toString — effectively unreachable with the current enum. It is a sentinel guard, not an input-dependent condition.

Solutions

  1. No caller action possible with the current enum; if it fires, a NullOrder constant was added without a toString case
  2. Update the switch when extending the enum
  3. Use the enum name() for machine-readable output instead of toString()
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at api/src/main/java/org/apache/iceberg/NullOrder.java:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/d7bb45703d555d86. Report an issue: GitHub.

Appendix: source

Thrown at api/src/main/java/org/apache/iceberg/NullOrder.java:33

 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.iceberg;

public enum NullOrder {
  NULLS_FIRST,
  NULLS_LAST;

  @Override
  public String toString() {
    switch (this) {
      case NULLS_FIRST:
        return "NULLS FIRST";
      case NULLS_LAST:
        return "NULLS LAST";
      default:
        throw new IllegalArgumentException("Unexpected null order: " + this);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)