{"record":{"id":"14fd832c0ec7f225","repo":"apache/beam","slug":"bad-parameter-type-for-s-v","errorCode":null,"errorMessage":"bad parameter type for %s: %v","messagePattern":"bad parameter type for (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/funcx/fn.go","lineNumber":434,"sourceCode":"\t\t\tkind = FnRTracker\n\t\tcase t.Implements(reflect.TypeOf((*sdf.WatermarkEstimator)(nil)).Elem()):\n\t\t\tkind = FnWatermarkEstimator\n\t\tcase typex.IsContainer(t), typex.IsConcrete(t), typex.IsUniversal(t):\n\t\t\tkind = FnValue\n\t\tcase IsEmit(t):\n\t\t\tkind = FnEmit\n\t\tcase IsIter(t):\n\t\t\tkind = FnIter\n\t\tcase IsReIter(t):\n\t\t\tkind = FnReIter\n\t\tcase IsMultiMap(t):\n\t\t\tkind = FnMultiMap\n\t\tcase t == typex.PaneInfoType:\n\t\t\tkind = FnPane\n\t\tdefault:\n\t\t\t// Error cases\n\t\t\tif ok, err := IsMalformedEmit(t); ok {\n\t\t\t\treturn nil, errors.Wrapf(err, \"bad parameter type for %s: %v\", fn.Name(), t)\n\t\t\t}\n\t\t\tif ok, err := IsMalformedIter(t); ok {\n\t\t\t\treturn nil, errors.Wrapf(err, \"bad parameter type for %s: %v\", fn.Name(), t)\n\t\t\t}\n\t\t\tif ok, err := IsMalformedReIter(t); ok {\n\t\t\t\treturn nil, errors.Wrapf(err, \"bad parameter type for %s: %v\", fn.Name(), t)\n\t\t\t}\n\t\t\tif ok, err := IsMalformedMultiMap(t); ok {\n\t\t\t\treturn nil, errors.Wrapf(err, \"bad parameter type for %s: %v\", fn.Name(), t)\n\t\t\t}\n\t\t\treturn nil, errors.Errorf(\"bad parameter type for %s: %v\", fn.Name(), t)\n\t\t}\n\n\t\tparam = append(param, FnParam{Kind: kind, T: t})\n\t}\n\n\tvar ret []ReturnParam\n\tfor i := 0; i < fn.Type().NumOut(); i++ {","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/funcx/fn.go#L416-L452","documentation":"funcx.New validates each parameter of a user function against known kinds (context, event time, emitters, iterators, multi-maps, etc.). When the parameter is a func type that looks like an emitter but is structurally illegal (unfoldEmit fails — e.g. emits interface{} or has a non-concrete parameter), IsMalformedEmit returns true and the wrapped error is raised as \"bad parameter type for <fnName>: <type>\".","triggerScenarios":"Binding a DoFn/CombineFn/DoFn process method whose parameter is a func(...) with return values, or an emitter whose element type is interface{} / a non-concrete type, or an emitter taking more than 2 parameters (beyond the optional EventTime).","commonSituations":"Writing emit funcs with wrong arity (func(T, U, V) instead of max T plus EventTime), emitting interface{} or unexported types, copying a signature that returns a value, typo in typex.EventTime placement.","solutions":["Read the wrapped cause: it names the illegal parameter (e.g. \"Type interface{} isn't a supported PCollection type\" or errIllegalParametersInEmit).","Make emitted element types concrete and JSON-codable (exported struct, basic type, or typex-registered type).","Reduce emitter arity to at most 2 params: optional typex.EventTime first, then 1–2 concrete element types.","Remove return values from emit funcs — emitters must have no outputs (NumOut == 0).","Replace interface{} / any parameters with a concrete type or a typex universal/container type."],"exampleFix":"// before\nfunc (f *MyFn) ProcessElement(e string, emit func(int, string, bool)) { ... } // 3 params: malformed emit\n\n// after\nfunc (f *MyFn) ProcessElement(e string, emit func(MyResult)) { ... } // 1 concrete element type","handlingStrategy":"validation","validationCode":"if ok, err := funcx.IsMalformedEmit(reflect.TypeOf(emitFn)); ok {\n  return fmt.Errorf(\"emit signature rejected: %w\", err)\n}","typeGuard":"func isValidEmit(t reflect.Type) bool {\n  ok, err := funcx.IsMalformedEmit(t)\n  return ok == false && err == nil && funcx.IsEmit(t)\n}","tryCatchPattern":"fn, err := funcx.New(reflect.ValueOf(processFn))\nif err != nil {\n  return fmt.Errorf(\"DoFn %T rejected: %w\", processFn, err)\n}","preventionTips":["Emitters: no return values, at most optional typex.EventTime + 1–2 concrete params.","Never emit interface{} or unexported types.","Validate DoFn signatures with funcx.New in unit tests.","Follow the documented DoFn signature patterns before adding extra parameters."],"tags":["go","beam","funcx","dofn","signature"],"backgroundTag":"invalid-argument-value","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"}