{"record":{"id":"2a5f28b10a12c950","repo":"DioxusLabs/dioxus","slug":"catch-all-route-segments-must-be-the-last-segment","errorCode":null,"errorMessage":"Catch-all route segments must be the last segment in a route. The route segments after the catch-all segment will never be matched.","messagePattern":"Catch-all route segments must be the last segment in a route\\. The route segments after the catch-all segment will never be matched\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/router-macro/src/segment.rs","lineNumber":205,"sourceCode":"\n            let field = fields.clone().find(|(name, _)| **name == ident);\n\n            let ty = if let Some(field) = field {\n                field.1.clone()\n            } else {\n                return Err(syn::Error::new(\n                    route_span,\n                    format!(\"Could not find a field with the name '{}'\", ident,),\n                ));\n            };\n            if spread {\n                route_segments.push(RouteSegment::CatchAll(\n                    Ident::new(&ident, Span::call_site()),\n                    ty,\n                ));\n\n                if iterator.next().is_some() {\n                    return Err(syn::Error::new(\n                        route_span,\n                        \"Catch-all route segments must be the last segment in a route. The route segments after the catch-all segment will never be matched.\",\n                    ));\n                } else {\n                    break;\n                }\n            } else {\n                route_segments.push(RouteSegment::Dynamic(\n                    Ident::new(&ident, Span::call_site()),\n                    ty,\n                ));\n            }\n        } else {\n            route_segments.push(RouteSegment::Static(segment.to_string()));\n        }\n    }\n\n    Ok((route_segments, query, hash))","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/router-macro/src/segment.rs#L187-L223","documentation":"`parse_route_segments` errors when a catch-all (`:..name`) segment is followed by more segments. Segments after a catch-all can never match because the catch-all consumes the rest of the path, so such routes are rejected at compile time.","triggerScenarios":"Thrown at packages/router-macro/src/segment.rs:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move the catch-all segment (..) to the end of the route; any segments after it can never be matched."],"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-23T08:17:48.524Z"}