{"record":{"id":"393d038bf4852af0","repo":"kataras/iris","slug":"t-does-not-allow-any-input-arguments-from-route-b","errorCode":null,"errorMessage":"%T does not allow any input arguments from route but got [len=%d,values=%s]","messagePattern":"%T does not allow any input arguments from route but got \\[len=(.+?),values=(.+?)\\]","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"macro/macro.go","lineNumber":117,"sourceCode":"\n// the convertBuilderFunc return value is generating at boot time.\n// convertFunc converts an interface to a valid full param function.\nfunc convertBuilderFunc(fn any) ParamFuncBuilder {\n\ttypFn := reflect.TypeOf(fn)\n\tif !goodParamFunc(typFn) {\n\t\t// it's not a function which returns a function,\n\t\t// it's not a a func(compileArgs) func(requestDynamicParamValue) bool\n\t\t// but it's a func(requestDynamicParamValue) bool, such as regexp.Compile.MatchString\n\t\tif typFn.NumIn() == 1 && typFn.In(0).Kind() == reflect.String && typFn.NumOut() == 1 && typFn.Out(0).Kind() == reflect.Bool {\n\t\t\tfnV := reflect.ValueOf(fn)\n\t\t\t// let's convert it to a ParamFuncBuilder which its combile route arguments are empty and not used at all.\n\t\t\t// the below return function runs on each route that this param type function is used in order to validate the function,\n\t\t\t// if that param type function is used wrongly it will be panic like the rest,\n\t\t\t// indeed the only check is the len of arguments not > 0, no types of values or conversions,\n\t\t\t// so we return it as soon as possible.\n\t\t\treturn func(args []string) reflect.Value {\n\t\t\t\tif n := len(args); n > 0 {\n\t\t\t\t\tpanic(fmt.Sprintf(\"%T does not allow any input arguments from route but got [len=%d,values=%s]\", fn, n, strings.Join(args, \", \")))\n\t\t\t\t}\n\t\t\t\treturn fnV\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tnumFields := typFn.NumIn()\n\n\tpanicIfErr := func(i int, err error) {\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"on field index: %d: %v\", i, err))\n\t\t}\n\t}\n\n\treturn func(args []string) reflect.Value {\n\t\tif len(args) != numFields {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/macro/macro.go#L99-L135","documentation":"A macro param type function registered without argument support panics at route validation when the route passes arguments to it (macro/macro.go:117). Param types registered with a func(string) bool accept no route arguments; the returned validator checks len(args) > 0 and panics naming the function type and the offending values.","triggerScenarios":"Using a route path like {name:string something} — passing arguments to a param type (e.g. string, int) that was registered as accepting none — during route registration.","commonSituations":"Copy-pasting param syntax from macros that do take arguments (e.g. enum(a|b), number range args) onto plain types like {id:int 5} or {name:string x}.","solutions":["Remove the arguments from the path parameter, e.g. use {id:int} instead of {id:int 5}.","Use a param type that supports arguments (e.g. enum, number with min/max) if you need to pass options.","If it's your own macro type, register it with an evaluator function signature that accepts arguments instead of func(string) bool."],"exampleFix":"// before\napp.Get(\"/{id:int 5}\", h)\n\n// after\napp.Get(\"/{id:int}\", h)","handlingStrategy":"validation","validationCode":"// Ensure plain param types carry no arguments\n// BAD: {id:int 5} — GOOD: {id:int}\nif strings.Contains(pathParam, \" \") && isPlainParamType(pathParam) {\n    log.Fatalf(\"param type %q takes no arguments\", pathParam)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        log.Fatalf(\"route macro misused: %v\", r)\n    }\n}()","preventionTips":["Only add space-separated arguments to param types documented as argument-enabled (enum, number with options).","Keep paths simple: {name:string}, {id:int}, {id:uint}, {id:alphabetical}.","Run route registration early in tests to catch panics before serving."],"tags":["go","panic","routing","path-parameters"],"backgroundTag":"invalid-route-parameter-syntax","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}