{"record":{"id":"8571138bf67afd70","repo":"apache/beam","slug":"incompatible-func-type-got-func-v-with-v-inputs-and-v-857113","errorCode":null,"errorMessage":"Incompatible func type: got func %v with %v inputs and %v outputs, want 6 inputs and 0 outputs","messagePattern":"Incompatible func type: got func (.+?) with (.+?) inputs and (.+?) outputs, want 6 inputs and 0 outputs","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/util/reflectx/calls.go","lineNumber":1295,"sourceCode":"}\n\nfunc (c *shimFunc6x0) Type() reflect.Type {\n\treturn c.inner.Type()\n}\n\nfunc (c *shimFunc6x0) Call(args []any) []any {\n\treturn c.inner.Call(args)\n}\n\nfunc (c *shimFunc6x0) Call6x0(arg0, arg1, arg2, arg3, arg4, arg5 any) {\n\tret := c.inner.Call([]any{arg0, arg1, arg2, arg3, arg4, arg5})\n\t_ = ret\n\treturn\n}\n\nfunc ToFunc6x0(c Func) Func6x0 {\n\tif c.Type().NumIn() != 6 || c.Type().NumOut() != 0 {\n\t\tpanic(fmt.Sprintf(\"Incompatible func type: got func %v with %v inputs and %v outputs, want 6 inputs and 0 outputs\", c.Type(), c.Type().NumIn(), c.Type().NumOut()))\n\t}\n\tif sc, ok := c.(Func6x0); ok {\n\t\treturn sc\n\t}\n\treturn &shimFunc6x0{inner: c}\n}\n\nfunc MakeFunc6x0(fn any) Func6x0 {\n\treturn ToFunc6x0(MakeFunc(fn))\n}\n\ntype Func6x1 interface {\n\tFunc\n\tCall6x1(any, any, any, any, any, any) any\n}\n\ntype shimFunc6x1 struct {\n\tinner Func","sourceCodeStart":1277,"sourceCodeEnd":1313,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/util/reflectx/calls.go#L1277-L1313","documentation":"reflectx.ToFunc6x0 wraps a reflectx.Func into a Func6x0 (6 inputs, no outputs). It panics with this message if the func's reflect.Type does not have exactly 6 inputs and 0 outputs, ensuring the void-returning shim can invoke it safely.","triggerScenarios":"Calling reflectx.ToFunc6x0(c) where c.Type().NumIn() != 6 or c.Type().NumOut() != 0 — e.g. a 6-input function that returns an error, or a 5-input void function.","commonSituations":"Sink DoFns with many parameters (context, event time, key, value, emit) that also return an error; arity mismatch after adding a parameter without updating registration to the right NxM helper.","solutions":["Change the function to take exactly 6 inputs and return nothing.","Use ToFunc6x1 (or appropriate variant) if the function returns values.","Verify the pipeline step expects a 6x0 signature and align parameters accordingly."],"exampleFix":"// before\nfunc fn(a A, b B, c C, d D, e E, f F) error { ... }\nreflectx.ToFunc6x0(fn) // panics: 1 output\n\n// after\nfunc fn(a A, b B, c C, d D, e E, f F) { ... }\nreflectx.ToFunc6x0(fn)","handlingStrategy":"validation","validationCode":"fn := reflect.TypeOf(fnAny)\nif fn.Kind() == reflect.Func && fn.NumIn() == 6 && fn.NumOut() == 0 {\n    _ = reflectx.ToFunc6x0(fnAny)\n}","typeGuard":"func isFunc6x0(f interface{}) bool {\n    t := reflect.TypeOf(f)\n    return t != nil && t.Kind() == reflect.Func && t.NumIn() == 6 && t.NumOut() == 0\n}","tryCatchPattern":"func safeToFunc6x0(c reflectx.Func) (f reflectx.Func6x0, err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"ToFunc6x0 failed: %v\", r)\n        }\n    }()\n    return reflectx.ToFunc6x0(c), nil\n}","preventionTips":["High-parameter-count sinks are error-prone; recount all 6 inputs when editing.","Return nothing from sink functions or switch to ToFunc6x1.","Add arity assertions in unit tests for every registration.","Update registration helpers in the same change as signature edits."],"tags":["go","apache-beam","reflection","function-signature"],"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"}