{"record":{"id":"7be51d3c1f637ed4","repo":"DioxusLabs/dioxus","slug":"expected-closure-argument-to-be-a-typed-pattern","errorCode":null,"errorMessage":"Expected closure argument to be a typed pattern","messagePattern":"Expected closure argument to be a typed pattern","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/router-macro/src/route_tree.rs","lineNumber":454,"sourceCode":"                    .enumerate()\n                    .skip_while(|(_, seg)| matches!(seg, RouteSegment::Static(_)));\n\n                let parse_query = redirect.parse_query();\n                let parse_hash = redirect.parse_hash();\n\n                let insure_not_trailing = redirect\n                    .segments\n                    .last()\n                    .map(|seg| !matches!(seg, RouteSegment::CatchAll(_, _)))\n                    .unwrap_or(true);\n\n                let redirect_function = &redirect.function;\n                let args = redirect_function.inputs.iter().map(|pat| match pat {\n                    syn::Pat::Type(ident) => {\n                        let name = &ident.pat;\n                        quote! {#name}\n                    }\n                    _ => panic!(\"Expected closure argument to be a typed pattern\"),\n                });\n                let return_redirect = quote! {\n                    (#redirect_function)(#(#args,)*)\n                };\n\n                print_route_segment(\n                    route_segments.peekable(),\n                    return_constructed(\n                        insure_not_trailing,\n                        return_redirect,\n                        &error_enum_name,\n                        enum_variant,\n                        &variant_parse_error,\n                        parse_query,\n                        parse_hash,\n                    ),\n                    &error_enum_name,\n                    enum_variant,","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/router-macro/src/route_tree.rs#L436-L472","documentation":"While generating redirect functions in the router macro, a closure argument pattern was not a typed pattern (e.g. a wildcard or invalid syntax). Redirect closures must bind typed arguments so the macro can parse query/segment parameters; anything else panics in to_tokens.","triggerScenarios":"Thrown at packages/router-macro/src/route_tree.rs:454 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the route closure argument an explicit typed pattern, e.g. |id: usize|."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}