{"record":{"id":"6502c589b00bd81a","repo":"apache/beam","slug":"reshuffletrigger-should-not-be-used-outside-of-reshuffle","errorCode":null,"errorMessage":"ReshuffleTrigger should not be used outside of Reshuffle","messagePattern":"ReshuffleTrigger should not be used outside of Reshuffle","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/ReshuffleTrigger.java","lineNumber":47,"sourceCode":" * state.\n *\n * @param <W> The kind of window that is being reshuffled.\n */\n@Internal\npublic class ReshuffleTrigger<W extends BoundedWindow> extends Trigger {\n\n  public ReshuffleTrigger() {\n    super();\n  }\n\n  @Override\n  protected Trigger getContinuationTrigger(List<Trigger> continuationTriggers) {\n    return this;\n  }\n\n  @Override\n  public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window) {\n    throw new UnsupportedOperationException(\n        \"ReshuffleTrigger should not be used outside of Reshuffle\");\n  }\n\n  @Override\n  public boolean mayFinish() {\n    return false;\n  }\n\n  @Override\n  public <OutputT> OutputT accept(TriggerVisitor<OutputT> visitor) {\n    return visitor.visit(this);\n  }\n\n  @Override\n  public String toString() {\n    return \"ReshuffleTrigger()\";\n  }\n}","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/ReshuffleTrigger.java#L29-L65","documentation":"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.","triggerScenarios":"Using ReshuffleTrigger directly in Window.triggering(...) or any code that calls getWatermarkThatGuaranteesFiring on a user-constructed ReshuffleTrigger.","commonSituations":"Developers copying Reshuffle internals to implement custom 'fire on reshuffle' semantics; reflection-based trigger inspection or serialization tests that walk all triggers.","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"],"exampleFix":"// before\nWindow.into(fn).triggering(new ReshuffleTrigger<>())\n// after\nWindow.into(fn).triggering(AfterWatermark.pastEndOfWindow())\n// or apply Reshuffle.viaRandomKey() instead","handlingStrategy":"type-guard","validationCode":"if (trigger instanceof ReshuffleTrigger) throw new IllegalArgumentException(\"Use Reshuffle.viaRandomKey() instead of ReshuffleTrigger directly\");","typeGuard":"boolean isUserUsableTrigger(Trigger t) { return !(t instanceof ReshuffleTrigger); }","tryCatchPattern":"try { windowing.triggering(myTrigger); } catch (UnsupportedOperationException e) { /* fall back to AfterWatermark.pastEndOfWindow() */ }","preventionTips":["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"],"tags":["java","apache-beam","trigger","internal-api"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}