{"record":{"id":"111dc8e7a141e11e","repo":"kataras/iris","slug":"makehandler-func-t-iris-handler-expected","errorCode":null,"errorMessage":"makeHandler: func(...<T>) iris.Handler: expected %d function input parameters but fewer static dependencies matched (%d)","messagePattern":"makeHandler: func\\(\\.\\.\\.<T>\\) iris\\.Handler: expected (.+?) function input parameters but fewer static dependencies matched \\((.+?)\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hero/handler.go","lineNumber":129,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\n\tv := valueOf(fn)\n\ttyp := v.Type()\n\tnumIn := typ.NumIn()\n\n\tbindings := getBindingsForFunc(v, c.Dependencies, c.DisablePayloadAutoBinding, paramsCount)\n\tc.fillReport(context.HandlerName(fn), bindings)\n\n\t// Check if it's a function that accept zero or more dependencies\n\t// and returns an Iris Handler.\n\tif paramsCount <= 0 {\n\t\t// println(irisHandlerType.String())\n\t\tif typ.NumOut() == 1 && isIrisHandlerType(typ.Out(0)) {\n\t\t\tinputs := getStaticInputs(bindings, numIn)\n\t\t\tif len(inputs) != numIn {\n\t\t\t\tpanic(fmt.Sprintf(\"makeHandler: func(...<T>) iris.Handler: expected %d function input parameters but fewer static dependencies matched (%d)\", numIn, len(inputs)))\n\t\t\t}\n\t\t\thandler := v.Call(inputs)[0].Interface().(context.Handler)\n\t\t\treturn handler\n\t\t}\n\t}\n\n\tresultHandler := defaultResultHandler\n\tfor i, lidx := 0, len(c.resultHandlers)-1; i <= lidx; i++ {\n\t\tresultHandler = c.resultHandlers[lidx-i](resultHandler)\n\t}\n\n\treturn func(ctx *context.Context) {\n\t\tinputs := make([]reflect.Value, numIn)\n\n\t\tfor _, binding := range bindings {\n\t\t\tinput, err := binding.Dependency.Handle(ctx, binding.Input)\n\t\t\tif err != nil {\n\t\t\t\tif err == ErrSeeOther {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/hero/handler.go#L111-L147","documentation":"When a registered function returns an iris.Handler (handler-producing function), all of its input parameters must be resolvable as static dependencies at setup time (no request-time inputs allowed). If fewer static inputs than parameters matched, the container cannot call it and panics.","triggerScenarios":"Registering func(a A, b B) iris.Handler where A or B has no static binding (unregistered type, or a dynamic/request-scoped dependency like a payload) via HandlerWithParams/MethodHandler.","commonSituations":"Middleware factories requiring request-scoped values (payloads, params) as inputs; forgetting to register one of the factory's dependency types; adding a new parameter to a factory without registering its type.","solutions":["Register every input type the factory needs: c.Register(a) etc., so all static inputs match.","Remove request-scoped parameters from the factory; obtain them inside the returned handler instead.","If the function should be a normal handler (request-time inputs), return nothing/handler-compatible signature rather than iris.Handler.","Count parameters vs. registered bindings and align them."],"exampleFix":"// before\nfunc auth(s *Session) iris.Handler { ... } // Session not registered\n// after\nc.Register(sessionSvc)\nfunc auth(s *SessionSvc) iris.Handler { ... }","handlingStrategy":"validation","validationCode":"t := reflect.TypeOf(factoryFn)\nfor i := 0; i < t.NumIn(); i++ {\n\tif !isRegisteredStatic(t.In(i)) { panic(\"missing static binding: \" + t.In(i).String()) }\n}","typeGuard":"func isStaticHandlerFactory(fn any) bool {\n\tt := reflect.TypeOf(fn)\n\treturn t.NumOut() == 1 && (t.Out(0) == irisHandlerType || t.Out(0) == irisHandlerFuncType)\n}","tryCatchPattern":null,"preventionTips":["Middleware factories returning iris.Handler must take only statically-bound inputs.","Register each dependency type a factory consumes.","Keep request-scoped data inside the returned handler, not as factory params."],"tags":["http-handler","static-binding","panic","middleware-factory"],"backgroundTag":"missing-static-dependency","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}