{"record":{"id":"9f13eda574d15048","repo":"kataras/iris","slug":"invalid-syntax-the-standard-go-type-s-found-in","errorCode":null,"errorMessage":"invalid syntax: the standard go type: %s found in controller's function: %s at position: %d does not match any valid macro","messagePattern":"invalid syntax: the standard go type: (.+?) found in controller's function: (.+?) at position: (.+?) does not match any valid macro","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mvc/controller_method_parser.go","lineNumber":267,"sourceCode":"\t\t// validMacros := p.macros.LookupForGoType(goType)\n\n\t\t// instead of mapping with a reflect.Kind which has its limitation,\n\t\t// we map the param types with a go type as a string,\n\t\t// so custom structs such as \"user\" can be mapped to a macro with indent || alias == \"user\".\n\t\tm = p.macros.Get(strings.ToLower(goType.String()))\n\n\t\tif m == nil {\n\t\t\tif typ.NumIn() > funcArgPos {\n\t\t\t\t// has more input arguments but we are not in the correct\n\t\t\t\t// index now, maybe the first argument was an `iris/context.Context`\n\t\t\t\t// so retry with the \"funcArgPos\" incremented.\n\t\t\t\t//\n\t\t\t\t// the \"funcArgPos\" will be updated to the caller as well\n\t\t\t\t// because we return it among the path and the error.\n\t\t\t\treturn p.parsePathParam(path, w, funcArgPos+1)\n\t\t\t}\n\n\t\t\treturn \"\", 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)\n\t\t}\n\t}\n\n\t// /{argfirst:path}, /{argfirst:int64}...\n\tif path[len(path)-1] != '/' {\n\t\tpath += \"/\"\n\t}\n\tpath += fmt.Sprintf(\"{%s:%s}\", paramKey, m.Indent())\n\n\tif nextWord == \"\" && typ.NumIn() > funcArgPos+1 {\n\t\t// By is the latest word but func is expected\n\t\t// more path parameters values, i.e:\n\t\t// GetBy(name string, age int)\n\t\t// The caller (parse) doesn't need to know\n\t\t// about the incremental funcArgPos because\n\t\t// it will not need it.\n\t\treturn p.parsePathParam(path, nextWord, funcArgPos+1)\n\t}","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/mvc/controller_method_parser.go#L249-L285","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfunc (c *Controller) Get(id uint) {}\n// after\nfunc (c *Controller) Get(id int64) {}","handlingStrategy":"validation","validationCode":"var supported = map[reflect.Kind]bool{\n    reflect.String: true, reflect.Int: true, reflect.Int64: true,\n    reflect.Float64: true, reflect.Bool: true,\n}\nfunc paramTypeOK(t reflect.Type) bool { return supported[t.Kind()] }","typeGuard":"func isMacroCompatible(v any) bool {\n    switch v.(type) {\n    case string, int, int8, int16, int32, int64,\n        uint, uint8, uint16, uint32, uint64,\n        float32, float64, bool:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := mvc.New(app).Handle(new(MyController)); err != nil {\n    if strings.Contains(err.Error(), \"does not match any valid macro\") {\n        log.Fatalf(\"controller param type unsupported: %v\", err)\n    }\n}","preventionTips":["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."],"tags":["mvc","routing","type-mismatch","validation"],"backgroundTag":"unsupported-parameter-type","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}