kataras/iris · error
invalid syntax: the standard go type: %s found in controller
Error message
invalid syntax: the standard go type: %s found in controller's function: %s at position: %d does not match any valid macro
What it means
When binding a controller method to a route, the mvc parser inspects each function parameter's Go type to infer a macro (int, int64, string, bool, etc.). If the parameter's type is a standard Go type that has no registered macro (e.g. float32, uint, time.Time, or a custom struct used as a path parameter), parsing aborts with this error, naming the type, the method, and the argument position.
Source
Thrown at mvc/controller_method_parser.go:267
// validMacros := p.macros.LookupForGoType(goType)
// instead of mapping with a reflect.Kind which has its limitation,
// we map the param types with a go type as a string,
// so custom structs such as "user" can be mapped to a macro with indent || alias == "user".
m = p.macros.Get(strings.ToLower(goType.String()))
if m == nil {
if typ.NumIn() > funcArgPos {
// has more input arguments but we are not in the correct
// index now, maybe the first argument was an `iris/context.Context`
// so retry with the "funcArgPos" incremented.
//
// the "funcArgPos" will be updated to the caller as well
// because we return it among the path and the error.
return p.parsePathParam(path, w, funcArgPos+1)
}
return "", 0, fmt.Errorf("invalid syntax: the standard go type: %s found in controller's function: %s at position: %d does not match any valid macro", goType, p.fn.Name, funcArgPos)
}
}
// /{argfirst:path}, /{argfirst:int64}...
if path[len(path)-1] != '/' {
path += "/"
}
path += fmt.Sprintf("{%s:%s}", paramKey, m.Indent())
if nextWord == "" && typ.NumIn() > funcArgPos+1 {
// By is the latest word but func is expected
// more path parameters values, i.e:
// GetBy(name string, age int)
// The caller (parse) doesn't need to know
// about the incremental funcArgPos because
// it will not need it.
return p.parsePathParam(path, nextWord, funcArgPos+1)
}View on GitHub (pinned to 7bedaf55a0)
Solutions
- Change the method parameter to a supported macro type (int, int64, string, bool, float64, etc.).
- Take the value as string and convert inside the method (e.g. parse UUID/time manually).
- Register a custom macro for the type via macro registry (context.RegisterMacro / handler.Macro) if it must stay typed.
- Check the reported position (funcArgPos, 0-based) to find the offending parameter quickly.
Example fix
// before
func (c *Controller) Get(id uint) {}
// after
func (c *Controller) Get(id int64) {} Defensive patterns
Strategy: validation
Validate before calling
var supported = map[reflect.Kind]bool{
reflect.String: true, reflect.Int: true, reflect.Int64: true,
reflect.Float64: true, reflect.Bool: true,
}
func paramTypeOK(t reflect.Type) bool { return supported[t.Kind()] } Type guard
func isMacroCompatible(v any) bool {
switch v.(type) {
case string, int, int8, int16, int32, int64,
uint, uint8, uint16, uint32, uint64,
float32, float64, bool:
return true
}
return false
} Try / catch
if err := mvc.New(app).Handle(new(MyController)); err != nil {
if strings.Contains(err.Error(), "does not match any valid macro") {
log.Fatalf("controller param type unsupported: %v", err)
}
} Prevention
- Use int/int64/string/bool/float64 for dynamic path parameters only.
- Convert UUID/time/custom types from string inside the method body.
- Register custom macros for exotic types instead of relying on defaults.
- Wire controllers in a startup test so type errors surface in CI.
When it happens
Trigger: Defining a controller method with a path parameter whose Go type is not one of the supported macro types (string, int, int8..., int64, uint..., float32/float64, bool) and binding it via Handle or PartyController.
Common situations: Using float32/uint for path params, or custom types like time.Time/uuid.UUID directly as dynamic path arguments without registering a custom macro or pre-converting to string.
Related errors
- errors joined from param parser: strings.Join(p.errors, "\n"
- parameter is not alphabetical
- parameter is not a file
- parameter is not a valid weekday
- no trailing path parameter found
AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30).
Data as JSON: /api/errors/9f13eda574d15048.
Report an issue: GitHub.