{"record":{"id":"026c3d86e5ac648d","repo":"apache/beam","slug":"pipelineoptions-not-set","errorCode":null,"errorMessage":"PipelineOptions not set","messagePattern":"PipelineOptions not set","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/AsyncWrapper.java","lineNumber":401,"sourceCode":"      BoundedWindow window,\n      Instant timestamp,\n      OutputReceiver<OutputT> receiver) {\n    return new ProcessArgProvider(element, window, timestamp, receiver);\n  }\n\n  // Named BaseArgumentProvider supplying bundle-level lifecycle context to the invoker.\n  private class BundleArgProvider extends DoFnInvoker.BaseArgumentProvider<InputT, OutputT> {\n    private final AccumulatingOutputReceiver<OutputT> receiver;\n\n    BundleArgProvider(AccumulatingOutputReceiver<OutputT> receiver) {\n      this.receiver = receiver;\n    }\n\n    @Override\n    public PipelineOptions pipelineOptions() {\n      PipelineOptions options = pipelineOptions;\n      if (options == null) {\n        throw new IllegalStateException(\"PipelineOptions not set\");\n      }\n      return options;\n    }\n\n    @Override\n    public DoFn<InputT, OutputT>.FinishBundleContext finishBundleContext(\n        DoFn<InputT, OutputT> doFn) {\n      return new AsyncFinishBundleContext(doFn, receiver);\n    }\n\n    @Override\n    public String getErrorContext() {\n      return \"AsyncWrapper/Bundle\";\n    }\n  }\n\n  // FinishBundleContext subclass bound to the enclosing DoFn instance to prevent compiler crashes.\n  private class AsyncFinishBundleContext extends DoFn<InputT, OutputT>.FinishBundleContext {","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/AsyncWrapper.java#L383-L419","documentation":"The FinishBundle-time argument provider exposes PipelineOptions to @FinishBundle methods; the options field is injected by the runner before invocation. If it is still null when pipelineOptions() is called, the wrapper throws IllegalStateException. This means the context object was used outside a runner-driven FinishBundle invocation.","triggerScenarios":"A @FinishBundle method (or code it calls) calls c.pipelineOptions() while the wrapper's pipelineOptions field was never populated — typically invoking the DoFn manually without a runner or without invoking setup with options.","commonSituations":"Unit tests that call finishBundle contexts directly; custom invokers that forget setPipelineOptions; runner integrations not passing options.","solutions":["Run the DoFn through a real runner or TestPipeline so options are injected before FinishBundle","In tests, use DoFnTester with a context that provides PipelineOptions (e.g. PipelineOptionsFactory.create())","If you own the invoker, call setPipelineOptions on the argument provider before invoking @FinishBundle"],"exampleFix":"// before\ncustomInvoker.invokeFinishBundle(provider); // provider has no options\n// after\nprovider.setPipelineOptions(PipelineOptionsFactory.create());\ncustomInvoker.invokeFinishBundle(provider);","handlingStrategy":"try-catch","validationCode":"// Before invoking FinishBundle manually:\noptions = PipelineOptionsFactory.create();\nprovider.setPipelineOptions(options);","typeGuard":null,"tryCatchPattern":"try {\n  invoker.invokeFinishBundle(provider);\n} catch (IllegalStateException e) {\n  if (e.getMessage().equals(\"PipelineOptions not set\")) {\n    provider.setPipelineOptions(PipelineOptionsFactory.create());\n    invoker.invokeFinishBundle(provider);\n  } else throw e;\n}","preventionTips":["Execute pipelines through a supported runner so options are injected automatically","Inject PipelineOptionsFactory.create() in any custom test invokers","Do not invoke @FinishBundle contexts outside the runner lifecycle"],"tags":["java","apache-beam","pipeline-options","lifecycle"],"backgroundTag":"missing-required-config","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}