apache/beam · error · UnsupportedOperationException

WatermarkEstimatorState unsupported in

Error message

WatermarkEstimatorState unsupported in %s

What it means

Requesting watermarkEstimatorState() from the stub DoFnInvoker throws UnsupportedOperationException. Watermark estimator state exists only in splittable-DoFn element processing on supporting runners; the base class always refuses.

Solutions

  1. Use an invoker built via DoFnInvokers and a runner that supports watermark estimation
  2. Consume WatermarkEstimatorState through the @ProcessElement method parameter instead of the invoker directly
  3. Remove/avoid watermark estimator parameters if the runner cannot support them

Example fix

// before
invoker.watermarkEstimatorState(); // throws
// after
@ProcessElement
public void process(ProcessContext c, RestrictionTracker<R, Long> t, WatermarkEstimatorStateW<Instant> ws) { ... }
Defensive patterns

Strategy: validation

Validate before calling

if (signature.watermarkEstimatorT() != null) {
  requireWatermarkCapableRunner();
}

Type guard

boolean supportsWatermarkEstimator(DoFnInvoker<?, ?> i) {
  return !(i instanceof DoFnInvoker.BaseDoFnInvoker);
}

Try / catch

try {
  Object st = invoker.watermarkEstimatorState();
} catch (UnsupportedOperationException e) {
  throw new IllegalStateException("Watermark estimator unsupported", e);
}

Prevention

When it happens

Trigger: Calling watermarkEstimatorState() on an invoker that inherits the base implementation, or during phases where no watermark estimator exists.

Common situations: SDF usage on runners lacking watermark-estimator support; hand-built test invokers; calling the accessor from @FinishBundle or timer callbacks.

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


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

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/DoFnInvoker.java:482

      throw new UnsupportedOperationException(
          String.format("Timer unsupported in %s", getErrorContext()));
    }

    @Override
    public RestrictionTracker<?, ?> restrictionTracker() {
      throw new UnsupportedOperationException(
          String.format("RestrictionTracker unsupported in %s", getErrorContext()));
    }

    @Override
    public Object watermarkEstimatorState() {
      throw new UnsupportedOperationException(
          String.format("WatermarkEstimatorState unsupported in %s", getErrorContext()));
    }

    @Override
    public WatermarkEstimator<?> watermarkEstimator() {
      throw new UnsupportedOperationException(
          String.format("WatermarkEstimator unsupported in %s", getErrorContext()));
    }

    @Override
    public BundleFinalizer bundleFinalizer() {
      throw new UnsupportedOperationException(
          String.format("BundleFinalizer unsupported in %s", getErrorContext()));
    }

    /**
     * Return a human readable representation of the current call context to be used during error
     * reporting.
     */
    public abstract String getErrorContext();
  }

  /** An {@link ArgumentProvider} that forwards all calls to the supplied {@code delegate}. */
  @Internal

View on GitHub (pinned to 12126d8942)