apache/beam · error · IllegalArgumentException

Unknown or unsupported WindowFn:

Error message

Unknown or unsupported WindowFn: 

What it means

Thrown by WindowingStrategyTranslation.windowFnFromProto when the FunctionSpec URN of a serialized WindowFn is neither a recognized built-in URN (fixed, sliding, sessions, etc.) nor the SERIALIZED_JAVA_WINDOWFN_URN payload form. The decoder has no strategy to reconstruct a WindowFn from that URN.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/WindowingStrategyTranslation.java:388

        return FixedWindows.of(Duration.millis(Durations.toMillis(fixedParams.getSize())))
            .withOffset(Duration.millis(Timestamps.toMillis(fixedParams.getOffset())));
      } else if (s.equals(getUrn(SlidingWindowsPayload.Enum.PROPERTIES))) {
        SlidingWindowsPayload slidingParams =
            SlidingWindowsPayload.parseFrom(windowFnSpec.getPayload());
        return SlidingWindows.of(Duration.millis(Durations.toMillis(slidingParams.getSize())))
            .every(Duration.millis(Durations.toMillis(slidingParams.getPeriod())))
            .withOffset(Duration.millis(Timestamps.toMillis(slidingParams.getOffset())));
      } else if (s.equals(getUrn(SessionWindowsPayload.Enum.PROPERTIES))) {
        SessionWindowsPayload sessionParams =
            SessionWindowsPayload.parseFrom(windowFnSpec.getPayload());
        return Sessions.withGapDuration(
            Duration.millis(Durations.toMillis(sessionParams.getGapSize())));
      } else if (s.equals(SERIALIZED_JAVA_WINDOWFN_URN)) {
        return (WindowFn<?, ?>)
            SerializableUtils.deserializeFromByteArray(
                windowFnSpec.getPayload().toByteArray(), "WindowFn");
      } else {
        throw new IllegalArgumentException(
            "Unknown or unsupported WindowFn: " + windowFnSpec.getUrn());
      }
    } catch (InvalidProtocolBufferException e) {
      throw new IllegalArgumentException(
          String.format(
              "%s for %s with URN %s did not contain expected proto message for payload",
              FunctionSpec.class.getSimpleName(),
              WindowFn.class.getSimpleName(),
              windowFnSpec.getUrn()),
          e);
    }
  }
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Upgrade the reading runner/SDK to a version that recognizes the WindowFn URN.
  2. Confirm the windowing used in the pipeline is a supported built-in (FixedWindows, SlidingWindows, Sessions, GlobalWindows) or a serializable Java WindowFn.
  3. If it is a custom WindowFn, ensure it was serialized under SERIALIZED_JAVA_WINDOWFN_URN with a valid payload.
  4. Inspect windowFnSpec.getUrn() in a debugger/logs to identify exactly which URN is unsupported.

Example fix

// before: custom URN unknown to reader
// after: force Java-serialized custom WindowFn handling
WindowFn<?, ?> wf = WindowingStrategyTranslation.windowFnFromProto(
    FunctionSpecs.serializeJavaWindowFn(myCustomWindowFn));
Defensive patterns

Strategy: validation

Validate before calling

String urn = windowFnSpec.getUrn();
boolean supported = org.apache.beam.sdk.util.construction.WindowingStrategies.FIXED_WINDOWS_URN.equals(urn)
 || org.apache.beam.sdk.util.construction.WindowingStrategies.SLIDING_WINDOWS_URN.equals(urn)
 || org.apache.beam.sdk.util.construction.WindowingStrategies.SESSION_WINDOWS_URN.equals(urn)
 || org.apache.beam.sdk.util.construction.WindowingStrategies.SERIALIZED_JAVA_WINDOWFN_URN.equals(urn);
if (!supported) throw new IllegalArgumentException("Unsupported WindowFn URN for this reader: " + urn);

Type guard

boolean isKnownWindowFnUrn(String urn) { return urn != null && KNOWN_WINDOWFN_URNS.contains(urn); }

Try / catch

try { wf = WindowingStrategyTranslation.windowFn(windowingStrategyProto); } catch (IllegalArgumentException e) { log.error("Unsupported WindowFn URN: {}", urn, e); throw e; }

Prevention

When it happens

Trigger: Reading a pipeline proto whose window_fn FunctionSpec carries an unknown/unsupported URN — e.g. a URN added in a newer Beam version, a runner-specific URN, or a corrupted URN string.

Common situations: Cross-version pipeline portability (new windowing type with an older reader); hand-edited or transformed pipeline protos; runners that only support a subset of built-in window functions.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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