apache/beam · error · UnsupportedOperationException

PipelineOptions unsupported in

Error message

PipelineOptions unsupported in %s

What it means

pipelineOptions() throws UnsupportedOperationException because this invoker implementation has no PipelineOptions provider bound. PipelineOptions access lets DoFns read runtime configuration; the base invoker cannot supply it. The message's error context identifies the invoker.

Solutions

  1. Bind a PipelineOptions factory when constructing the invoker (or pass PipelineOptions.as(DoFnInvoker factory))
  2. Run the DoFn through the runner/DoFnTester, which supplies real PipelineOptions
  3. Pass required options explicitly instead of reading them from the context in test code
  4. Construct a TestPipelineOptions in tests rather than relying on the invoker

Example fix

// before
MyOpts opts = context.getPipelineOptions().as(MyOpts.class); // throws in custom invoker
// after
DoFnInvoker invoker = DoFnInvokers.newInvoker(doFn,
    DoFnInvoker.PipelineOptionsProvider.boundTo(PipelineOptionsFactory.create()));
Defensive patterns

Strategy: try-catch

Validate before calling

boolean hasOptions = invokerProvider != null; // confirm PipelineOptionsProvider bound

Type guard

null

Try / catch

try { opts = invoker.pipelineOptions(doFn).as(MyOpts.class); } catch (UnsupportedOperationException e) { opts = PipelineOptionsFactory.create().as(MyOpts.class); }

Prevention

When it happens

Trigger: Calling invoker.pipelineOptions(doFn) on a DelegatingDoFnInvoker built without a pipelineOptionsFactory; DoFn code calling context.getPipelineOptions() through an invoker lacking options binding.

Common situations: Custom invocation utilities (testing, wrappers) that don't pass PipelineOptions; DoFn unit tests using hand-built invokers; context objects created outside a real pipeline run.

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

Appendix: source

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

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

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

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

    @Override
    public DoFn<InputT, OutputT>.OnWindowExpirationContext onWindowExpirationContext(

View on GitHub (pinned to 12126d8942)