{"record":{"id":"8b5966cb385c04c7","repo":"apache/beam","slug":"s-is-not-compatible-with-s","errorCode":null,"errorMessage":"%s is not compatible with %s","messagePattern":"(.+?) is not compatible with (.+?)","errorType":"exception","errorClass":"IncompatibleWindowException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/WindowFn.java","lineNumber":107,"sourceCode":"\n  /**\n   * Returns whether this performs the same merging as the given {@code WindowFn}.\n   *\n   * @deprecated please override verifyCompatibility to throw a useful error message; we will remove\n   *     isCompatible at version 3.0.0\n   */\n  @Deprecated\n  public abstract boolean isCompatible(WindowFn<?, ?> other);\n\n  /**\n   * Throw {@link IncompatibleWindowException} if this WindowFn does not perform the same merging as\n   * the given ${@code WindowFn}.\n   *\n   * @throws IncompatibleWindowException if compared WindowFns are not compatible.\n   */\n  public void verifyCompatibility(WindowFn<?, ?> other) throws IncompatibleWindowException {\n    if (!this.isCompatible(other)) {\n      throw new IncompatibleWindowException(\n          other,\n          String.format(\n              \"%s is not compatible with %s\",\n              this.getClass().getSimpleName(), other.getClass().getSimpleName()));\n    }\n  }\n\n  /** Returns the {@link Coder} used for serializing the windows used by this windowFn. */\n  public abstract Coder<W> windowCoder();\n\n  /**\n   * Returns the default {@link WindowMappingFn} to use to map main input windows to side input\n   * windows. This should accept arbitrary main input windows, and produce a {@link BoundedWindow}\n   * that can be produced by this {@link WindowFn}.\n   */\n  public abstract WindowMappingFn<W> getDefaultWindowMappingFn();\n\n  /** Returns true if this {@code WindowFn} never needs to merge any windows. */","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/WindowFn.java#L89-L125","documentation":"WindowFn.verifyCompatibility() checks whether two window functions can be composed in the same pipeline stage (e.g. when re-windowing or merging inputs/outputs). If this.isCompatible(other) returns false, it throws IncompatibleWindowException naming the two WindowFn classes. This guards against semantically meaningless combinations such as merging a fixed-windows PCollection with a sliding-windows view.","triggerScenarios":"Applying Window.into/setWindowFn with a WindowFn incompatible with the input's existing windowing strategy (WindowFn.isCompatible returned false); also triggered by transforms like GBK/re-windowing that call verifyCompatibility during expand().","commonSituations":"Combining or following a Window transform with a differently-shaped WindowFn (FixedWindows vs SlidingWindows, different gaps); passing a re-windowed PCollection into GroupByKey; library code composing user-supplied window functions.","solutions":["Insert an explicit re-windowing step (apply Window.into(newFn)) so the input is transformed to the target windowing before composition.","Use window functions that are mutually compatible (same WindowFn class and compatible parameters as per isCompatible()).","Catch IncompatibleWindowException in pipeline-construction helpers and surface a clearer message about which WindowFns conflict."],"exampleFix":"// before\nPCollection<T> out = fixedWindowed.apply(Window.<T>into(SlidingWindows.of(StandardMinutes.of(10)).every(StandardMinutes.of(5)))); // combined elsewhere with incompatible fn\n// after\nPCollection<T> rewindowed = fixedWindowed.apply(Window.<T>into(SlidingWindows.of(StandardMinutes.of(10)).every(StandardMinutes.of(5))));\nPCollection<T> out = rewindowed.apply(...); // only compose after the explicit re-windowing","handlingStrategy":"try-catch","validationCode":"// pre-check (requires access): if (!fnA.isCompatible(fnB)) { reWindow first }","typeGuard":null,"tryCatchPattern":"try {\n  windowFn.verifyCompatibility(other);\n} catch (IncompatibleWindowException e) {\n  // insert Window.into(...) re-windowing step or fail with explanatory message\n}","preventionTips":["Insert an explicit Window.into(newFn) whenever changing windowing before grouping transforms.","Never assume two differently-parameterized WindowFns are compatible; check isCompatible in helpers.","Group only within a single windowing strategy per PCollection."],"tags":["java","apache-beam","windowing","type-mismatch"],"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-14T16:17:12.679Z"}