apache/beam · error · IllegalArgumentException

Unknown

Error message

Unknown %s: %s

What it means

WindowFnTestUtils.assignOutputTime throws IllegalArgumentException when the TimestampCombiner passed to validateGetOutputTimestamps is not EARLIEST, LATEST, or END_OF_WINDOW. It is a defensive default-case guard for an unexpected enum value.

Solutions

  1. Use one of the supported combiners (EARLIEST, LATEST, END_OF_WINDOW) in the test
  2. Update Beam so the test utility supports your combiner
  3. Test output timestamps outside WindowFnTestUtils with a custom harness

Example fix

// before
validateGetOutputTimestamps(fn, TimestampCombiner.OTHER, windows)
// after
validateGetOutputTimestamps(fn, TimestampCombiner.EARLIEST, windows)
Defensive patterns

Strategy: validation

Validate before calling

if (combiner != TimestampCombiner.EARLIEST && combiner != TimestampCombiner.LATEST && combiner != TimestampCombiner.END_OF_WINDOW) {
  throw new IllegalArgumentException("WindowFnTestUtils supports only EARLIEST/LATEST/END_OF_WINDOW");
}

Try / catch

try { validateGetOutputTimestamps(fn, combiner, windows); }
catch (IllegalArgumentException e) { /* fall back to custom harness for unsupported combiner */ }

Prevention

When it happens

Trigger: Passing a TimestampCombiner other than EARLIEST/LATEST/END_OF_WINDOW into WindowFnTestUtils.validateGetOutputTimestamps* (e.g. a future/combiner variant the test util doesn't handle).

Common situations: Testing a WindowFn configured with a newer TimestampCombiner that the testing utility predates, or accidentally passing the wrong combiner in test wiring.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/40ae9c07f50d7621. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/testing/WindowFnTestUtils.java:311

      if (earlierEndingWindow != null) {
        assertThat(
            outputTimestamp, greaterThan((ReadableInstant) earlierEndingWindow.maxTimestamp()));
      }

      earlierEndingWindow = window;
    }
  }

  private static Instant assignOutputTime(
      TimestampCombiner timestampCombiner, Instant inputTimestamp, BoundedWindow window) {
    switch (timestampCombiner) {
      case EARLIEST:
      case LATEST:
        return inputTimestamp;
      case END_OF_WINDOW:
        return window.maxTimestamp();
      default:
        throw new IllegalArgumentException(
            String.format("Unknown %s: %s", TimestampCombiner.class, timestampCombiner));
    }
  }

  private static Instant combineOutputTimes(
      TimestampCombiner timestampCombiner, Iterable<Instant> outputInstants) {
    checkArgument(
        !Iterables.isEmpty(outputInstants),
        "Cannot combine zero instants with %s",
        timestampCombiner);
    switch (timestampCombiner) {
      case EARLIEST:
        return Ordering.natural().min(outputInstants);
      case LATEST:
        return Ordering.natural().max(outputInstants);
      case END_OF_WINDOW:
        return outputInstants.iterator().next();
      default:

View on GitHub (pinned to 12126d8942)