apache/beam · error · IllegalStateException

SolaceIO.Write.UnboundedSolaceWriter.Context: BoundedWindow

Error message

SolaceIO.Write.UnboundedSolaceWriter.Context: BoundedWindow is required for a FinishBundleContext.

What it means

UnboundedSolaceWriter.Context.output throws this IllegalStateException when emitting via a FinishBundleContext without a BoundedWindow. FinishBundleContext.output requires both an explicit timestamp and window; a null window means the emitting code path didn't supply the window of the element being output.

Source

Thrown at sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/write/UnboundedSolaceWriter.java:362

      beamContextWrapper.finishBundleContext = finishBundleContext;
      return beamContextWrapper;
    }

    public <T> void output(
        TupleTag<T> tag,
        T output,
        @Nullable Instant timestamp, // Not required for windowed context
        @Nullable BoundedWindow window) { // Not required for windowed context
      if (windowedContext != null) {
        windowedContext.output(tag, output);
      } else if (finishBundleContext != null) {
        if (timestamp == null) {
          throw new IllegalStateException(
              "SolaceIO.Write.UnboundedSolaceWriter.Context: Timestamp is required for a"
                  + " FinishBundleContext.");
        }
        if (window == null) {
          throw new IllegalStateException(
              "SolaceIO.Write.UnboundedSolaceWriter.Context: BoundedWindow is required for a"
                  + " FinishBundleContext.");
        }
        finishBundleContext.output(tag, output, timestamp, window);
      } else {
        throw new IllegalStateException(
            "SolaceIO.Write.UnboundedSolaceWriter.Context: No context provided");
      }
    }
  }
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Ensure the emitting code captures and passes the element's BoundedWindow (e.g. IntervalWindow from the ProcessContext) to context.output in finishBundle.
  2. If you subclass the writer, store the window alongside buffered results when they're first received, then pass it on output.
  3. For global-window pipelines, pass the GlobalWindow instance explicitly rather than null.
  4. Check the Beam version for known connector issues with window propagation in finishBundle.

Example fix

// before
context.output(tag, result, timestamp, null); // window lost
// after
context.output(tag, result, timestamp, window); // window captured from ProcessContext.window()
Defensive patterns

Strategy: validation

Validate before calling

if (finishBundleContext != null && window == null) {
  throw new IllegalStateException("finishBundle output requires a non-null BoundedWindow");
}

Try / catch

try { context.output(tag, results, ts, window); } catch (IllegalStateException e) { if (e.getMessage().contains("BoundedWindow is required")) { /* capture window from ProcessContext */ } throw e; }

Prevention

When it happens

Trigger: Calling Context.output(tag, output, timestamp, null) with finishBundleContext active (windowedContext null) — publishResults or a subclass emitting results without a window during finishBundle.

Common situations: Custom writer subclasses that drop the window when collecting results during the bundle; windowed pipelines where results were gathered outside their window context; internal connector bug after a Beam core API change.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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