apache/beam · error · UnsupportedOperationException

TimeDomain unsupported in

Error message

TimeDomain unsupported in %s

What it means

The invoker base implementation throws UnsupportedOperationException from timeDomain() when no TimeDomain provider is bound. This accessor is meant to be available inside @OnTimer callbacks to learn whether the timer fired on event time or processing time. The message names the invoker's error context so developers can tell which invoker lacks support.

Solutions

  1. Run the DoFn via a runner/invoke path that supplies TimeDomain (real pipeline execution or updated DoFnTester)
  2. Provide a timeDomainFactory when constructing the invoker via DoFnInvokers
  3. Guard timeDomain() access behind an OnTimerContext check
  4. Upgrade Beam/runner version if the runner added time-domain support

Example fix

// before
TimeDomain td = invoker.timeDomain(doFn);
// after
if (context instanceof DoFn.OnTimerContext) {
  TimeDomain td = ((DoFn.OnTimerContext) context).getTimeDomain();
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean supported = context instanceof DoFn.OnTimerContext;

Type guard

if (!(context instanceof DoFn.OnTimerContext)) return null; TimeDomain td = ((DoFn.OnTimerContext) context).getTimeDomain();

Try / catch

try { td = invoker.timeDomain(doFn); } catch (UnsupportedOperationException e) { td = null; }

Prevention

When it happens

Trigger: Calling doFnInvocator.timeDomain(doFn) (or context code resolving time domain) on an invoker created without a timeDomainFactory, e.g. DelegatingDoFnInvoker or a minimal generated invoker.

Common situations: Unit-testing a DoFn with a hand-rolled invoker that stubs unsupported accessors; executing on a runner that does not expose time domain; accessing timeDomain outside a timer callback.

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/c3035465ea1add49. Report an issue: GitHub.

Appendix: source

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

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

    @Override
    public String timerId(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("TimerId unsupported in %s", getErrorContext()));
    }

    @Override
    public TimeDomain timeDomain(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("TimeDomain unsupported in %s", getErrorContext()));
    }

    @Override
    public OutputReceiver<OutputT> outputReceiver(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("OutputReceiver unsupported in %s", getErrorContext()));
    }

    @Override
    public OutputReceiver<Row> outputRowReceiver(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("Row OutputReceiver unsupported in %s", getErrorContext()));
    }

    @Override
    public MultiOutputReceiver taggedOutputReceiver(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("MultiOutputReceiver unsupported in %s", getErrorContext()));
    }

    @Override
    public Object restriction() {
      throw new UnsupportedOperationException(

View on GitHub (pinned to 12126d8942)