{"record":{"id":"d15f51291fcdaab1","repo":"apache/beam","slug":"restrictiontracker-unsupported-in-s","errorCode":null,"errorMessage":"RestrictionTracker unsupported in %s","messagePattern":"RestrictionTracker 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":476,"sourceCode":"      throw new UnsupportedOperationException(\n          String.format(\"State unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public Timer timer(String timerId) {\n      throw new UnsupportedOperationException(\n          String.format(\"Timer unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public RestrictionTracker<?, ?> restrictionTracker() {\n      throw new UnsupportedOperationException(\n          String.format(\"RestrictionTracker unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public Object watermarkEstimatorState() {\n      throw new UnsupportedOperationException(\n          String.format(\"WatermarkEstimatorState unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public WatermarkEstimator<?> watermarkEstimator() {\n      throw new UnsupportedOperationException(\n          String.format(\"WatermarkEstimator unsupported in %s\", getErrorContext()));\n    }\n\n    @Override\n    public BundleFinalizer bundleFinalizer() {\n      throw new UnsupportedOperationException(\n          String.format(\"BundleFinalizer unsupported in %s\", getErrorContext()));\n    }\n\n    /**\n     * Return a human readable representation of the current call context to be used during error\n     * reporting.","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/DoFnInvoker.java#L458-L494","documentation":"The stub DoFnInvoker throws UnsupportedOperationException for restrictionTracker(). A RestrictionTracker is only available while invoking splittable-DoFn @ProcessElement methods on runners that support SDF; the base class never provides one.","triggerScenarios":"Calling restrictionTracker() on a placeholder invoker, or during a lifecycle phase (finishBundle, onTimer) that has no restriction tracker.","commonSituations":"Splittable DoFns run on runners without SDF support; test harnesses using the base invoker; accessing the tracker outside the element-processing phase.","solutions":["Run the SDF on a runner that supports splittable DoFn and use the DoFnInvokers-built invoker","Request the RestrictionTracker only via the @ProcessElement method parameter, not directly during other phases","Check the DoFnSignature: restrictionTracker support requires @GetInitialRestriction/@SplitRestriction etc."],"exampleFix":"// before\ninvoker.restrictionTracker(); // throws in non-SDF phases\n// after\n@ProcessElement\npublic void process(ProcessContext c, RestrictionTracker<MyRestr, Long> tracker) { ... }","handlingStrategy":"validation","validationCode":"if (signature.trackerT() != null) {\n  requireSdfCapableRunner();\n}","typeGuard":"boolean supportsRestrictionTracker(DoFnInvoker<?, ?> i) {\n  return !(i instanceof DoFnInvoker.BaseDoFnInvoker);\n}","tryCatchPattern":"try {\n  tracker = invoker.restrictionTracker();\n} catch (UnsupportedOperationException e) {\n  throw new IllegalStateException(\"SDF not supported here\", e);\n}","preventionTips":["Only run splittable DoFns on SDF-capable runners","Access the tracker via the @ProcessElement parameter","Read DoFnSignature.trackerT() to confirm the DoFn is splittable before invoking SDF paths"],"tags":["java","apache-beam","unsupported-operation","splittable-dofn"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}