apache/beam · error

method %v has sdf.RTracker as param %v, expected none

Error message

method %v has sdf.RTracker as param %v, expected none

What it means

validateIsSdf checks ProcessElement for an sdf.RTracker parameter. If ProcessElement has an sdf.RTracker parameter but the DoFn was not determined to be a SplittableDoFn (isSdf false), this error is thrown: the RTracker parameter is only valid in splittable DoFns.

Source

Thrown at sdks/go/pkg/beam/core/graph/fn.go:877

			missing = append(missing, name)
		}
	}

	var isSdf bool
	switch len(missing) {
	case 0: // All SDF methods present.
		isSdf = true
	case len(requiredSdfNames): // No SDF methods.
		isSdf = false
	default: // Anything else means an invalid # of SDF methods.
		err := errors.Errorf("not all required SplittableDoFn methods are present. Missing methods: %v", missing)
		return false, err
	}

	processFn := fn.methods[processElementName]
	if pos, ok := processFn.RTracker(); ok != isSdf {
		if ok {
			err := errors.Errorf("method %v has sdf.RTracker as param %v, expected none",
				processElementName, pos)
			return false, errors.SetTopLevelMsgf(err, "Method %v has an sdf.RTracker parameter at index %v, "+
				"but is not part of a splittable DoFn. sdf.RTracker is invalid in %v in non-splittable DoFns.",
				processElementName, pos, processElementName)
		}
		pos, _, _ = processFn.Inputs()
		err := errors.Errorf("method %v missing sdf.RTracker, expected one at index %v",
			processElementName, pos)
		return false, errors.SetTopLevelMsgf(err, "Method %v is missing an sdf.RTracker "+
			"parameter despite being part of a splittable DoFn. %v in splittable DoFns requires an "+
			"sdf.RTracker parameter before main inputs (in this case, at index %v).",
			processElementName, processElementName, pos)
	}
	return isSdf, nil
}

// validateSdfSignatures validates that types in the SDF methods of a Fn are
// consistent with each other (for example, element and restriction types should

View on GitHub (pinned to 12126d8942)

Solutions

  1. Implement all required SDF methods so the DoFn qualifies as a SplittableDoFn.
  2. Or remove the sdf.RTracker parameter from ProcessElement if the DoFn should not be splittable.
  3. Check required SDF method signatures/names are exactly as Beam expects.

Example fix

// before
func (fn *myFn) ProcessElement(rt sdf.RTracker, w string, emit func(int)) {}
// no CreateInitialRestriction etc.

// after: either add the full SDF method set, or
func (fn *myFn) ProcessElement(w string, emit func(int)) {} // non-splittable
Defensive patterns

Strategy: validation

Validate before calling

// only add sdf.RTracker to ProcessElement once the full SDF method set exists:
if _, ok := reflect.TypeOf(fn).MethodByName("CreateInitialRestriction"); !ok { /* don't use RTracker yet */ }

Type guard

func sdfReady(fn interface{}) bool { return isCompleteSdf(fn) } // complete set before using RTracker

Try / catch

if err := beam.ParDo(s, fn, in); err != nil {
	if strings.Contains(err.Error(), "sdf.RTracker") { log.Fatalf("RTracker used in non-splittable DoFn: %v", err) }
}

Prevention

When it happens

Trigger: Adding sdf.RTracker to ProcessElement without implementing the complete set of required SDF methods (either no SDF methods or an inconsistent set already rejected), then calling AsDoFn via beam.ParDo.

Common situations: Copying only the ProcessElement signature from an SDF example without the other SDF methods; deleting the SDF helper methods during refactoring while keeping the RTracker parameter; typos in required SDF method names so they aren't detected.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/2d0627f8211668c4. Report an issue: GitHub.