apache/beam · error · UnsupportedOperationException
ReshuffleTrigger should not be used outside of Reshuffle
Error message
ReshuffleTrigger should not be used outside of Reshuffle
What it means
ReshuffleTrigger is an internal trigger that only makes sense inside the Reshuffle transform, where it is driven by the reshuffle machinery. Its getWatermarkThatGuaranteesFiring has no well-defined answer outside that context, so calling it throws UnsupportedOperationException.
Solutions
- Do not use ReshuffleTrigger directly; use the Reshuffle transform instead
- Replace with an explicit trigger such as AfterWatermark.pastEndOfWindow() or Repeatedly.forever(...)
- If you need reshuffle-like behavior, use Reshuffle.viaRandomKey() rather than reimplementing its trigger
Example fix
// before Window.into(fn).triggering(new ReshuffleTrigger<>()) // after Window.into(fn).triggering(AfterWatermark.pastEndOfWindow()) // or apply Reshuffle.viaRandomKey() instead
Defensive patterns
Strategy: type-guard
Validate before calling
if (trigger instanceof ReshuffleTrigger) throw new IllegalArgumentException("Use Reshuffle.viaRandomKey() instead of ReshuffleTrigger directly"); Type guard
boolean isUserUsableTrigger(Trigger t) { return !(t instanceof ReshuffleTrigger); } Try / catch
try { windowing.triggering(myTrigger); } catch (UnsupportedOperationException e) { /* fall back to AfterWatermark.pastEndOfWindow() */ } Prevention
- Never import classes from org.apache.beam.sdk.transforms.windowing intended for internal use
- Use the Reshuffle transform itself instead of replicating its trigger
- Review Beam upgrade notes for internal trigger changes
When it happens
Trigger: Using ReshuffleTrigger directly in Window.triggering(...) or any code that calls getWatermarkThatGuaranteesFiring on a user-constructed ReshuffleTrigger.
Common situations: Developers copying Reshuffle internals to implement custom 'fire on reshuffle' semantics; reflection-based trigger inspection or serialization tests that walk all triggers.
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
- Continuation of a OnceTrigger must be a OnceTrigger
- is for internal use only and does not support case dispatch
- A function must be provided to convert the input type into…
- A PValue contained in
- A schema was provided without a data format (or viceversa)…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6502c589b00bd81a.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/ReshuffleTrigger.java:47
* state.
*
* @param <W> The kind of window that is being reshuffled.
*/
@Internal
public class ReshuffleTrigger<W extends BoundedWindow> extends Trigger {
public ReshuffleTrigger() {
super();
}
@Override
protected Trigger getContinuationTrigger(List<Trigger> continuationTriggers) {
return this;
}
@Override
public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window) {
throw new UnsupportedOperationException(
"ReshuffleTrigger should not be used outside of Reshuffle");
}
@Override
public boolean mayFinish() {
return false;
}
@Override
public <OutputT> OutputT accept(TriggerVisitor<OutputT> visitor) {
return visitor.visit(this);
}
@Override
public String toString() {
return "ReshuffleTrigger()";
}
}View on GitHub (pinned to 12126d8942)