{"record":{"id":"1b979078c7d16c44","repo":"apache/beam","slug":"valuekind-unsupported-in-s","errorCode":null,"errorMessage":"ValueKind unsupported in %s","messagePattern":"ValueKind unsupported in (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/DoFnInvoker.java","lineNumber":378,"sourceCode":"      throw new UnsupportedOperationException(\n          String.format(\"FireTimestamp unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public CausedByDrain causedByDrain(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"CausedByDrain unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public ValueKind valueKind(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"ValueKind unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public String timerId(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"TimerId unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public TimeDomain timeDomain(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"TimeDomain unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public OutputReceiver<OutputT> outputReceiver(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"OutputReceiver unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public OutputReceiver<Row> outputRowReceiver(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/DoFnInvoker.java#L360-L396","documentation":"DoFnInvoker's UnsupportedInvocationBehavior throws this when a callback calls valueKind() in an invocation context that cannot report whether the current value is a plain element or a bundle-final element. valueKind() is a splittable-DoFn / specialized-runner concept; the default behavior has no kind to report and refuses the call. The message context names the DoFn and callback that made the invalid request.","triggerScenarios":"Calling context.valueKind() from @ProcessElement or timer callbacks when the DoFn is invoked with UnsupportedInvocationBehavior — e.g. via DoFnInvokers.invokerFor(...) in tests or on runners without ValueKind support.","commonSituations":"Writing DoFn code that references valueKind() but running it on a runner or test harness that never sets it; copying splittable-DoFn idioms into ordinary DoFns; custom runner implementations lacking this API.","solutions":["Remove the valueKind() call unless you specifically depend on bundle-final element semantics and run on a supporting runner","Default the kind when unavailable: catch UnsupportedOperationException and treat it as the ordinary-element kind","Test the DoFn with TestPipeline / runner-backed DoFnRunner instead of the default invoker","If ValueKind is essential, ensure the execution path uses a DoFnRunner implementation that supports it (e.g. SplittableDoFn paths)"],"exampleFix":"// before\nValueKind kind = context.valueKind();\n// after\nValueKind kind;\ntry { kind = context.valueKind(); } catch (UnsupportedOperationException e) { kind = ValueKind.ELEMENT; }","handlingStrategy":"fallback","validationCode":"// Only read valueKind() when running on a runner path that supports it;\n// in ordinary DoFns treat every element as ValueKind.ELEMENT.","typeGuard":"DoFn.ValueKind safeValueKind(DoFn.ProcessContext ctx) {\n  try { return ctx.valueKind(); }\n  catch (UnsupportedOperationException e) { return DoFn.ValueKind.ELEMENT; }\n}","tryCatchPattern":"try {\n  DoFn.ValueKind kind = context.valueKind();\n} catch (UnsupportedOperationException e) {\n  DoFn.ValueKind kind = DoFn.ValueKind.ELEMENT; // assume ordinary element\n}","preventionTips":["Use valueKind() only in code paths known to run on ValueKind-aware runners","Default to ELEMENT semantics when the accessor is unavailable","Avoid copying ValueKind idioms into DoFns executed by default invokers or simple test harnesses"],"tags":["java","apache-beam","dofn","splittable-dofn","unsupported-operation"],"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"}