{"record":{"id":"ce0c317b9694166c","repo":"kataras/iris","slug":"passed-argument-is-not-a-func-iris-context-ne","errorCode":null,"errorMessage":"\n\t\t\tPassed argument is not a func(iris.Context) neither one of these types:\n\t\t\t- http.Handler\n\t\t\t- func(w http.ResponseWriter, r *http.Request)\n\t\t\t- func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)\n\t\t\t---------------------------------------------------------------------\n\t\t\tIt seems to be a %T points to: %v","messagePattern":"\n\t\t\tPassed argument is not a func\\(iris\\.Context\\) neither one of these types:\n\t\t\t- http\\.Handler\n\t\t\t- func\\(w http\\.ResponseWriter, r \\*http\\.Request\\)\n\t\t\t- func\\(w http\\.ResponseWriter, r \\*http\\.Request, next http\\.HandlerFunc\\)\n\t\t\t---------------------------------------------------------------------\n\t\t\tIt seems to be a %T points to: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlerconv/from_std.go","lineNumber":48,"sourceCode":"\t\treturn FromStd(http.HandlerFunc(h))\n\tcase func(http.ResponseWriter, *http.Request, http.HandlerFunc):\n\t\t// handlerFunc(w,r, http.HandlerFunc)\n\t\t//\n\t\treturn FromStdWithNext(h)\n\tcase func(http.Handler) http.Handler:\n\t\tpanic(fmt.Errorf(`\n\t\t\tPassed handler cannot be converted directly:\n\t\t\t- http.Handler(http.Handler)\n\t\t\t---------------------------------------------------------------------\n\t\t\tPlease use the Application.WrapRouter method instead, example code:\n\t\t\tapp := iris.New()\n\t\t\t// ...\n\t\t\tapp.WrapRouter(func(w http.ResponseWriter, r *http.Request, router http.HandlerFunc) {\n\t\t\t    httpThirdPartyHandler(router).ServeHTTP(w, r)\n\t\t\t})`))\n\tdefault:\n\t\t// No valid handler passed\n\t\tpanic(fmt.Errorf(`\n\t\t\tPassed argument is not a func(iris.Context) neither one of these types:\n\t\t\t- http.Handler\n\t\t\t- func(w http.ResponseWriter, r *http.Request)\n\t\t\t- func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)\n\t\t\t---------------------------------------------------------------------\n\t\t\tIt seems to be a %T points to: %v`, handler, handler))\n\t}\n}\n\n// FromStdWithNext receives a standar handler - middleware form - and returns a\n// compatible context.Handler wrapper.\nfunc FromStdWithNext(h func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)) context.Handler {\n\treturn func(ctx *context.Context) {\n\t\tnext := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx.ResetRequest(r)\n\t\t\tctx.Next()\n\t\t}\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/core/handlerconv/from_std.go#L30-L66","documentation":"FromStd panics when the argument is not a func(iris.Context), http.Handler, func(http.ResponseWriter,*http.Request), or func(...,next http.HandlerFunc). The error message includes the actual type and value for diagnosis.","triggerScenarios":"Passing an unsupported value to FromStd or iris handlers registration: e.g. a bare struct, a func() , func(ctx *iris.Context) (old signature), a non-callable value, or a method value with the wrong signature.","commonSituations":"Migrating from old iris versions where handlers took *iris.Context; passing nil handler; passing an interface holding the wrong concrete type; typos like handler.ServeHTTP instead of handler.","solutions":["Pass one of the supported types: func(iris.Context), http.Handler, func(w,r), or func(w,r,next).","If you have func(ctx *iris.Context) from old code, migrate it to func(ctx iris.Context) (new Context API).","Ensure you pass the method/function value itself, not the result of calling it, and that it is not nil.","Wrap the value in http.HandlerFunc(yourFunc) when its signature is almost right."],"exampleFix":"// before\napp.Handle(\"GET\", \"/\", oldHandler) // func(*iris.Context) -> panic\n// after\napp.Handle(\"GET\", \"/\", func(ctx iris.Context) { oldLogic(ctx) }) // or http.HandlerFunc","handlingStrategy":"type-guard","validationCode":"switch h.(type) {\ncase func(iris.Context), http.Handler, func(http.ResponseWriter, *http.Request), func(http.ResponseWriter, *http.Request, http.HandlerFunc):\n    // ok\ndefault:\n    return errors.New(\"unsupported handler type\")\n}","typeGuard":"func isConvertibleHandler(v interface{}) bool {\n    switch v.(type) {\n    case func(iris.Context), http.Handler,\n        func(http.ResponseWriter, *http.Request),\n        func(http.ResponseWriter, *http.Request, http.HandlerFunc):\n        return true\n    }\n    return false\n}","tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        if strings.Contains(fmt.Sprint(r), \"not a func(iris.Context)\") {\n            log.Fatalf(\"bad handler type: %v\", r)\n        }\n        panic(r)\n    }\n}()","preventionTips":["Migrate old func(*iris.Context) handlers to func(iris.Context)","Never pass nil handlers or call results of handler functions","Wrap plain funcs with http.HandlerFunc when signatures match"],"tags":["panic","handler-conversion","type-mismatch"],"backgroundTag":"invalid-handler-type","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}