kataras/iris · error
%T does not allow any input arguments from route but got [le
Error message
%T does not allow any input arguments from route but got [len=%d,values=%s]
What it means
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.
Source
Thrown at macro/macro.go:117
// the convertBuilderFunc return value is generating at boot time.
// convertFunc converts an interface to a valid full param function.
func convertBuilderFunc(fn any) ParamFuncBuilder {
typFn := reflect.TypeOf(fn)
if !goodParamFunc(typFn) {
// it's not a function which returns a function,
// it's not a a func(compileArgs) func(requestDynamicParamValue) bool
// but it's a func(requestDynamicParamValue) bool, such as regexp.Compile.MatchString
if typFn.NumIn() == 1 && typFn.In(0).Kind() == reflect.String && typFn.NumOut() == 1 && typFn.Out(0).Kind() == reflect.Bool {
fnV := reflect.ValueOf(fn)
// let's convert it to a ParamFuncBuilder which its combile route arguments are empty and not used at all.
// the below return function runs on each route that this param type function is used in order to validate the function,
// if that param type function is used wrongly it will be panic like the rest,
// indeed the only check is the len of arguments not > 0, no types of values or conversions,
// so we return it as soon as possible.
return func(args []string) reflect.Value {
if n := len(args); n > 0 {
panic(fmt.Sprintf("%T does not allow any input arguments from route but got [len=%d,values=%s]", fn, n, strings.Join(args, ", ")))
}
return fnV
}
}
return nil
}
numFields := typFn.NumIn()
panicIfErr := func(i int, err error) {
if err != nil {
panic(fmt.Sprintf("on field index: %d: %v", i, err))
}
}
return func(args []string) reflect.Value {
if len(args) != numFields {View on GitHub (pinned to 7bedaf55a0)
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.
Example fix
// before
app.Get("/{id:int 5}", h)
// after
app.Get("/{id:int}", h) Defensive patterns
Strategy: validation
Validate before calling
// Ensure plain param types carry no arguments
// BAD: {id:int 5} — GOOD: {id:int}
if strings.Contains(pathParam, " ") && isPlainParamType(pathParam) {
log.Fatalf("param type %q takes no arguments", pathParam)
} Try / catch
defer func() {
if r := recover(); r != nil {
log.Fatalf("route macro misused: %v", r)
}
}() Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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}.
Related errors
- args(len=%d) should be the same len as numFields(%d) for: %s
- %s: invalid path part: dynamic path parameter and other para
- %s: parameter type "%s" should be registered to the very end
- iris: switch: hosts: invalid target type: %T
- <appName> is not a registered Application
AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30).
Data as JSON: /api/errors/393d038bf4852af0.
Report an issue: GitHub.