{"record":{"id":"d88d16a6af643808","repo":"apache/beam","slug":"invalid-output-type-in-method-v-return-value-at-index-v-got-d88d16","errorCode":null,"errorMessage":"Invalid output type in method %v, return value at index %v. Got: %v, Want: %v. Sizing information in SDF methods must be in float64.","messagePattern":"Invalid output type in method (.+?), return value at index (.+?)\\. Got: (.+?), Want: (.+?)\\. Sizing information in SDF methods must be in float64\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/fn.go","lineNumber":1045,"sourceCode":"\t\t\t\t\t\"return value at index %v. Got: %v, Want: %v (from method %v). \"+\n\t\t\t\t\t\"Ensure that all restrictions in an SDF are the same type, and that %v returns a slice.\",\n\t\t\t\t\tsplitRestrictionName, 0, method.Ret[0].T, reflect.SliceOf(restrictionT), createInitialRestrictionName, splitRestrictionName)\n\t\t\t}\n\t\tcase restrictionSizeName:\n\t\t\tif err := validateSdfElementT(fn, restrictionSizeName, method, num, startIdx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tidx := num + startIdx\n\t\t\tif method.Param[idx].T != restrictionT {\n\t\t\t\terr := errors.Errorf(\"mismatched restriction type in method %v, param %v. got: %v, want: %v\",\n\t\t\t\t\trestrictionSizeName, idx, method.Param[idx].T, restrictionT)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"Mismatched restriction type in method %v, \"+\n\t\t\t\t\t\"parameter at index %v. Got: %v, Want: %v (from method %v). \"+\n\t\t\t\t\t\"Ensure that all restrictions in an SDF are the same type.\",\n\t\t\t\t\trestrictionSizeName, idx, method.Param[idx].T, restrictionT, createInitialRestrictionName)\n\t\t\t}\n\t\t\tif method.Ret[0].T != reflectx.Float64 {\n\t\t\t\terr := errors.Errorf(\"invalid output type in method %v, return %v. got: %v, want: %v\",\n\t\t\t\t\trestrictionSizeName, 0, method.Ret[0].T, reflectx.Float64)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"Invalid output type in method %v, \"+\n\t\t\t\t\t\"return value at index %v. Got: %v, Want: %v. Sizing information in SDF methods must be in float64.\",\n\t\t\t\t\trestrictionSizeName, 0, method.Ret[0].T, reflectx.Float64)\n\t\t\t}\n\t\tcase createTrackerName:\n\t\t\tif method.Param[startIdx].T != restrictionT {\n\t\t\t\terr := errors.Errorf(\"mismatched restriction type in method %v, param %v. got: %v, want: %v\",\n\t\t\t\t\tcreateTrackerName, startIdx, method.Param[startIdx].T, restrictionT)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"Mismatched restriction type in method %v, \"+\n\t\t\t\t\t\"parameter at index %v. Got: %v, Want: %v (from method %v). \"+\n\t\t\t\t\t\"Ensure that all restrictions in an SDF are the same type.\",\n\t\t\t\t\tcreateTrackerName, startIdx, method.Param[startIdx].T, restrictionT, createInitialRestrictionName)\n\t\t\t}\n\t\t\tif !method.Ret[0].T.Implements(rTrackerT) {\n\t\t\t\terr := errors.Errorf(\"invalid output type in method %v, return %v: %v does not implement sdf.RTracker\",\n\t\t\t\t\tcreateTrackerName, 0, method.Ret[0].T)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"Invalid output type in method %v, \"+","sourceCodeStart":1027,"sourceCodeEnd":1063,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/fn.go#L1027-L1063","documentation":"RestrictionSize must return a float64 sizing value. This error fires when its first return value is any other type (int, int64, float32, etc.), because the framework requires sizing information to be float64 for consistent bundle sizing.","triggerScenarios":"Declaring RestrictionSize with return type int, int64, float32, or a custom numeric type instead of float64.","commonSituations":"Using Go's default numeric literals/len() results (int) as the return; copying code that used float32; minimal-effort ports from other SDKs where sizes are ints.","solutions":["Change RestrictionSize's return to float64 and convert internally (e.g. float64(len(...))).","Remove any error return if unneeded, keeping float64 (optionally last error is allowed per count check).","Update any computed size expressions to produce float64 values.","Re-run registration to confirm no other SDF method type mismatches remain."],"exampleFix":"// before\nfunc (fn *myFn) RestrictionSize(r myRestriction) int { return len(r.List) }\n\n// after\nfunc (fn *myFn) RestrictionSize(r myRestriction) float64 { return float64(len(r.List)) }","handlingStrategy":"validation","validationCode":"// Assert RestrictionSize returns float64:\nfunc checkSizeReturn(t reflect.Type) error {\n    rs, ok := t.MethodByName(\"RestrictionSize\")\n    if !ok { return nil }\n    if rs.Type.Out(0) != reflect.TypeOf(float64(0)) {\n        return fmt.Errorf(\"RestrictionSize must return float64, got %v\", rs.Type.Out(0))\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write RestrictionSize as func(...) float64","Wrap len()/numeric computations in float64() conversions","Never use float32 for SDF sizing"],"tags":["go","apache-beam","sdf","type-mismatch","float64"],"backgroundTag":"type-mismatch","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"}