{"record":{"id":"6cb9ab8da14c26cb","repo":"apache/beam","slug":"only-fixedwindows-objects-with-the-same-size-and-offset-are","errorCode":null,"errorMessage":"Only FixedWindows objects with the same size and offset are compatible.","messagePattern":"Only FixedWindows objects with the same size and offset are compatible\\.","errorType":"exception","errorClass":"IncompatibleWindowException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/FixedWindows.java","lineNumber":119,"sourceCode":"        .add(DisplayData.item(\"size\", size).withLabel(\"Window Duration\"))\n        .addIfNotDefault(\n            DisplayData.item(\"offset\", offset).withLabel(\"Window Start Offset\"), Duration.ZERO);\n  }\n\n  @Override\n  public Coder<IntervalWindow> windowCoder() {\n    return IntervalWindow.getCoder();\n  }\n\n  @Override\n  public boolean isCompatible(WindowFn<?, ?> other) {\n    return this.equals(other);\n  }\n\n  @Override\n  public void verifyCompatibility(WindowFn<?, ?> other) throws IncompatibleWindowException {\n    if (!this.isCompatible(other)) {\n      throw new IncompatibleWindowException(\n          other,\n          String.format(\n              \"Only %s objects with the same size and offset are compatible.\",\n              FixedWindows.class.getSimpleName()));\n    }\n  }\n\n  public Duration getSize() {\n    return size;\n  }\n\n  public Duration getOffset() {\n    return offset;\n  }\n\n  @Override\n  public boolean equals(@Nullable Object object) {\n    if (!(object instanceof FixedWindows)) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/FixedWindows.java#L101-L137","documentation":"FixedWindows.verifyCompatibility throws IncompatibleWindowException when a FixedWindows-windowed PCollection is merged with one using FixedWindows of a different size or offset. Beam can only align windows element-wise across sources when both sides use identical window size and offset.","triggerScenarios":"CoGroupByKey/Join/Flatten of PCollections where one used FixedWindows.of(Duration.ofMinutes(5)) and the other FixedWindows.of(Duration.ofMinutes(10)) or a different withOffset value.","commonSituations":"Two jobs written with different tumbling-window sizes joined downstream; a refactor changed one side's size/offset; offset added to only one side for timezone alignment.","solutions":["Use the same FixedWindows size and offset on every input to the merge.","Define the FixedWindows factory (size, offset) in shared constants/config consumed by both pipelines.","Re-window one PCollection into the other's FixedWindows before the join.","If alignment is unnecessary, merge using GlobalWindows (Window.into(GlobalWindows())) first."],"exampleFix":"// before\nPCollection<A> a = inA.apply(Window.into(FixedWindows.of(Duration.standardMinutes(5))));\nPCollection<B> b = inB.apply(Window.into(FixedWindows.of(Duration.standardMinutes(10))));\n// after\nFixedWindows win = FixedWindows.of(Duration.standardMinutes(5)).withOffset(OFFSET);\nPCollection<A> a = inA.apply(Window.into(win));\nPCollection<B> b = inB.apply(Window.into(win));","handlingStrategy":"validation","validationCode":"FixedWindows a = FixedWindows.of(Duration.standardMinutes(5)).withOffset(OFFSET);\nif (other instanceof FixedWindows) {\n  FixedWindows b = (FixedWindows) other;\n  boolean compatible = a.getSize().equals(b.getSize()) && a.getOffset().equals(b.getOffset());\n}","typeGuard":null,"tryCatchPattern":"try {\n  fixedWindows.verifyCompatibility(otherWindowFn);\n} catch (IncompatibleWindowException e) {\n  throw new IllegalStateException(\"FixedWindows size/offset mismatch across merge inputs\", e);\n}","preventionTips":["Build all FixedWindows from one shared constant/factory.","Record window size and offset alongside each pipeline's config.","Check window equality in integration tests before joins.","Use window().calling flow: re-window one side to match before CoGroupByKey."],"tags":["java","apache-beam","windowing","incompatibility"],"backgroundTag":"incompatible-source-type","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"}