{"record":{"id":"e8caff07313d00a9","repo":"apache/beam","slug":"recordid-unsupported-in-s","errorCode":null,"errorMessage":"RecordId unsupported in %s","messagePattern":"RecordId 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":354,"sourceCode":"      throw new UnsupportedOperationException(\n          String.format(\"Schema element unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public Instant timestamp(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"Timestamp unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public @Nullable String currentRecordId(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"RecordId unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public @Nullable Long currentRecordOffset(DoFn<InputT, OutputT> doFn) {\n      throw new UnsupportedOperationException(\n          String.format(\"RecordOffset unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public Instant fireTimestamp(DoFn<InputT, OutputT> doFn) {\n      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(","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/DoFnInvoker.java#L336-L372","documentation":"DoFnInvoker's default UnsupportedInvocationBehavior throws this when a DoFn callback calls currentRecordOffset() in a context where the invocation behavior does not support it. Record/offset access is only meaningful for splittable-DoFn element+restriction processing; runners or invocation contexts that don't supply bundle data reject the call. It signals that the DoFn is asking for bundle metadata the current execution mode cannot provide.","triggerScenarios":"Calling context.currentRecordOffset() (via a DoFnParameter or onBundleStart/Finish callbacks) when the DoFn is invoked with UnsupportedInvocationBehavior — e.g. via DoFnInvokers.tryInvokeSetUpProcessElementAndFinishBundle or a runner path that uses ProcessContext with no bundle data, or invoking a splittable-DoFn-only accessor from a non-DoFn runner context.","commonSituations":"Running a DoFn that uses splittable-DoFn bundle-data accessors (currentRecord, currentElement with restriction, currentRecordOffset) on a runner or test harness that does not provide bundle data; unit-testing such a DoFn with a plain invoker instead of DoFnTestUtils/TestPipeline; calling offset accessors outside onWindowExpiration or timer callbacks where they are unsupported.","solutions":["Remove the currentRecordOffset() call unless the DoFn is a genuine splittable DoFn (extends DoFn and is executed with the SDF expansion processElement+restriction)","Test the DoFn with TestPipeline or DoFnTestUtils rather than invoking it directly with DoFnInvokers.invokerFor(...)","Guard the accessor with a capability check (e.g. isBounded/Context information) and fall back to a no-op or logged skip when bundle data is unavailable","Use an invoker whose InvocationBehavior supports bundle data (e.g. the runner's DoFnRunner) instead of the default UnsupportedInvocationBehavior"],"exampleFix":"// before\n@ProcessElement\npublic void process(ProcessContext c, OffsetRangeTracker tracker) {\n  long off = c.currentRecordOffset();\n}\n// after\n@ProcessElement\npublic void process(ProcessContext c) {\n  // use the element itself, not bundle metadata\n  T value = c.element();\n}","handlingStrategy":"validation","validationCode":"// Before invoking the DoFn, ensure it is a splittable DoFn with bundle-data support,\n// or invoke it through a runner-backed DoFnRunner rather than the default invoker:\nif (!isSplittableDoFn(myDoFn)) {\n  throw new IllegalStateException(\"DoFn uses currentRecordOffset but is not a splittable DoFn\");\n}","typeGuard":"boolean supportsBundleData(DoFnInvoker.BundlingContext ctx) {\n  return ctx != null && !ctx.getClass().getSimpleName().equals(\"UnsupportedInvocationBehavior\");\n}","tryCatchPattern":"try {\n  long offset = context.currentRecordOffset();\n} catch (UnsupportedOperationException e) {\n  // bundle data unavailable in this context; fall back\n  LOG.warn(\"currentRecordOffset unsupported here: {}\", e.getMessage());\n}","preventionTips":["Only use bundle-data accessors (currentRecord/currentRecordOffset) inside real splittable DoFn element processing","Never invoke DoFns directly with DoFnInvokers.invokerFor(...) in production or tests; use TestPipeline or DoFnTestUtils","Check runner documentation for splittable-DoFn/bundle-data support before using these APIs"],"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"}