apache/beam · error · UnsupportedOperationException

Restriction unsupported in

Error message

Restriction unsupported in %s

What it means

restriction() throws UnsupportedOperationException because this invoker has no restriction provider bound. It is used by splittable DoFn (SDF) machinery to access the current restriction. The error context identifies the unsupported invoker.

Solutions

  1. Execute the SDF through a runner that supports splittable DoFn and wires restriction providers
  2. Bind a restriction factory when constructing the invoker
  3. Verify the DoFn's element type/restriction tracker are properly parameterized for SDF
  4. Upgrade Beam / runner to a version with SDF support

Example fix

// before
Object r = invoker.restriction(); // throws
// after
RestrictionTracker<?, ?> tracker = context.getRestrictionTracker(); // runner-provided
Defensive patterns

Strategy: validation

Validate before calling

boolean sdf = doFn instanceof DoFn.RequiresSplitPoll; // or check RestrictionTracker presence in context

Type guard

null

Try / catch

try { Object r = invoker.restriction(); } catch (UnsupportedOperationException e) { throw new IllegalStateException("SDF context required", e); }

Prevention

When it happens

Trigger: Accessing invoker.restriction() on a DelegatingDoFnInvoker or an invoker built without a restrictionFactory; splittable-DoFn code paths (e.g. @GetInitialRestriction, @ProcessElement with RestrictionTracker) invoked through a non-SDF invoker.

Common situations: Using a splittable DoFn on a runner or test harness without SDF support; invoking SDF methods via DoFnInvokers without binding restriction tracking; older Beam version where the runner lacked SDF support.

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

Appendix: source

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

      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(
          String.format("Restriction unsupported in %s", getErrorContext()));
    }

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

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

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

    @Override
    public DoFn<InputT, OutputT>.StartBundleContext startBundleContext(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(

View on GitHub (pinned to 12126d8942)