{"record":{"id":"9969cf907f4a012b","repo":"apache/beam","slug":"tagged-output-not-supported-in-finishbundlecontext-for","errorCode":null,"errorMessage":"Tagged output not supported in FinishBundleContext for AsyncWrapper","messagePattern":"Tagged output not supported in FinishBundleContext for AsyncWrapper","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/AsyncWrapper.java","lineNumber":444,"sourceCode":"    }\n\n    @Override\n    public PipelineOptions getPipelineOptions() {\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 void output(OutputT output, Instant timestamp, BoundedWindow window) {\n      receiver.outputWithTimestamp(output, timestamp);\n    }\n\n    @Override\n    public <T> void output(TupleTag<T> tag, T output, Instant timestamp, BoundedWindow window) {\n      throw new UnsupportedOperationException(\n          \"Tagged output not supported in FinishBundleContext for AsyncWrapper\");\n    }\n  }\n\n  // BaseArgumentProvider supplying element-level context to the invoker.\n  private class ProcessArgProvider extends DoFnInvoker.BaseArgumentProvider<InputT, OutputT> {\n    private final KV<K, InputT> element;\n    private final BoundedWindow window;\n    private final Instant timestamp;\n    private final OutputReceiver<OutputT> receiver;\n\n    ProcessArgProvider(\n        KV<K, InputT> element,\n        BoundedWindow window,\n        Instant timestamp,\n        OutputReceiver<OutputT> receiver) {\n      this.element = element;\n      this.window = window;","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/AsyncWrapper.java#L426-L462","documentation":"Beam's FinishBundleContext supports tagged output via TupleTag, but AsyncWrapper's FinishBundle path does not wire additional output tags, so output(TupleTag, ...) unconditionally throws UnsupportedOperationException. Only the untagged output(output, timestamp, window) is supported on this wrapper.","triggerScenarios":"The wrapped DoFn's @FinishBundle method calls c.output(someTupleTag, value, timestamp, window), or the DoFn declares additional outputs that the finish-bundle logic tries to emit through.","commonSituations":"Migrating an existing DoFn with side outputs to be wrapped by AsyncWrapper; generic DoFn utilities that always use the tagged overload.","solutions":["Emit only through the untagged main output in @FinishBundle when using AsyncWrapper","Move side-output emissions to @ProcessElement, or perform them outside the async wrapper","Restructure the pipeline so side outputs are produced by a separate non-wrapped transform"],"exampleFix":"// before\nc.output(sideTag, value, timestamp, window); // in @FinishBundle\n// after\nc.output(value, timestamp, window); // main output only, or emit side outputs elsewhere","handlingStrategy":"validation","validationCode":"// Before wrapping a DoFn, check its @FinishBundle for tagged output:\nfor (Method m : doFn.getClass().getDeclaredMethods()) {\n  if (m.isAnnotationPresent(FinishBundle.class)\n      && Arrays.stream(m.getParameterTypes()).anyMatch(t -> TupleTag.class.isAssignableFrom(t))) {\n    throw new IllegalArgumentException(\"DoFn uses tagged output in FinishBundle; incompatible with AsyncWrapper\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep @FinishBundle emissions to the main (untagged) output when using AsyncWrapper","Move side-output logic into @ProcessElement or a downstream transform","Audit DoFns for additional-output declarations before wrapping them asynchronously"],"tags":["java","apache-beam","unsupported-operation","side-outputs"],"backgroundTag":"unsupported-operation","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"}