{"record":{"id":"d80727b8406de352","repo":"kataras/iris","slug":"no-trailing-path-parameter-found","errorCode":null,"errorMessage":"no trailing path parameter found","messagePattern":"no trailing path parameter found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mvc/controller_method_parser.go","lineNumber":245,"sourceCode":"\t\t// By found but input arguments are not there, so act like /by path without restricts.\n\t\tpath = addPathWord(path, w)\n\t\treturn path, funcArgPos, nil\n\t}\n\n\tvar (\n\t\tparamKey  = genParamKey(funcArgPos) // argfirst, argsecond...\n\t\tm         = p.macros.GetMaster()    // default (String by-default)\n\t\ttrailings = p.macros.GetTrailings()\n\t)\n\n\t// string, int...\n\tgoType := typ.In(funcArgPos).Kind()\n\tnextWord := p.lexer.peekNext()\n\n\tif nextWord == tokenWildcard {\n\t\tp.lexer.skip() // skip the Wildcard word.\n\t\tif len(trailings) == 0 {\n\t\t\treturn \"\", 0, errors.New(\"no trailing path parameter found\")\n\t\t}\n\t\tm = trailings[0]\n\t} else {\n\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.","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/mvc/controller_method_parser.go#L227-L263","documentation":"This error is raised by parsePathParam in the MVC controller method-to-route parser when the path template uses a wildcard '{param:string ...}' marker but no trailing parameter type was actually registered before it. In practice it means the method signature/path combination implies a trailing wildcard parameter that does not exist.","triggerScenarios":"An MVC controller method is registered whose path ends with the wildcard token but whose parameter list does not define a matching trailing parameter (trailings slice is empty), so when the lexer peeks the wildcard token there is no trailing param to map.","commonSituations":"Hand-writing path templates with '...' or wildcard syntax on MVC controller methods; typos like '{param:string ...}' without the macro registering a trailing entry; refactoring method signatures and leaving stale wildcard syntax in the path.","solutions":["Remove the stray wildcard token from the controller method's path template.","Ensure the method has a trailing string parameter matching the wildcard, e.g. func (c *Controller) Get(path string).","Register the route with the standard router (app.Handle) instead of MVC if exotic wildcard syntax is needed."],"exampleFix":"// before\nfunc (c *FileController) GetBy(path string, rest string) {} // path: /files/{p:string ...} with mismatched param\n\n// after\nfunc (c *FileController) GetByWildcard(path string) {} // single trailing param: /files/{path:string ...}","handlingStrategy":"validation","validationCode":"// ensure every wildcard in an MVC path has exactly one trailing string param\n// /files/{path:string ...} requires: func (c *Ctl) GetBy(path string)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one trailing parameter per wildcard in MVC controller methods.","Remove leftover '...' tokens after refactors.","Test MVC route registration in unit tests so this surfaces at boot."],"tags":["mvc","routing","wildcard","iris"],"backgroundTag":"invalid-route-wildcard","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}