{"record":{"id":"b324a65ca9a837ae","repo":"DioxusLabs/dioxus","slug":"catch-all-segments-are-not-allowed-in-nests","errorCode":null,"errorMessage":"Catch all segments are not allowed in nests","messagePattern":"Catch all segments are not allowed in nests","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/router-macro/src/route_tree.rs","lineNumber":175,"sourceCode":"                                },\n                                index,\n                            };\n\n                            // If it doesn't, add the segment to the current route\n                            let static_segment = self.entries.insert(static_segment);\n\n                            let current_children = current_route\n                                .map(|id| self.children_mut(id))\n                                .unwrap_or_else(|| &mut segments);\n                            current_children.push(static_segment);\n\n                            // Update the current route\n                            current_route = Some(static_segment);\n                        }\n                        // If there is a dynamic segment, stop adding static segments\n                        RouteSegment::Dynamic(..) => break,\n                        RouteSegment::CatchAll(..) => {\n                            unimplemented!(\"Catch all segments are not allowed in nests\")\n                        }\n                    }\n                }\n\n                // Add the nest to the current route\n                let nest = RouteTreeSegmentData::Nest {\n                    nest,\n                    children: Vec::new(),\n                };\n\n                let nest = self.entries.insert(nest);\n                let segments = match current_route.and_then(|id| self.get_mut(id)) {\n                    Some(RouteTreeSegmentData::Static { children, .. }) => children,\n                    Some(RouteTreeSegmentData::Nest { children, .. }) => children,\n                    Some(r) => {\n                        unreachable!(\"{current_route:?}\\n{r:?} is not a static or nest segment\",)\n                    }\n                    None => &mut segments,","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/router-macro/src/route_tree.rs#L157-L193","documentation":"When #[derive(Routable)] builds its route tree, it walks each nest's path segments: static segments extend the tree, dynamic segments stop static processing, and a CatchAll segment inside a nest path immediately panics via unimplemented!(\"Catch all segments are not allowed in nests\"). Catch-all segments like :..rest are only valid on routes, never inside a #[nest(\"...\")] prefix.","triggerScenarios":"Writing a Route enum whose #[nest(\"...\")] attribute path contains a catch-all segment, e.g. #[nest(\"/docs/:..rest\")]. The proc macro panics while constructing the parse tree, so the crate fails to compile.","commonSituations":"Trying to make a nest 'own' all remaining URL space (e.g. a wiki nest that should capture arbitrary subpaths); refactoring a flat catch-all route into a nest and moving the :..rest segment into the nest attribute by mistake.","solutions":["Keep the nest path static and put the catch-all on a route inside it: #[nest(\"/docs\")] plus #[route(\"/:..rest\")] DocsRest { rest: Vec<String> }","Replace the catch-all in the nest prefix with a dynamic segment and enumerate the remaining matching in child routes","If the nest must capture everything, drop the nest and use a single catch-all route with a layout instead"],"exampleFix":"// before: catch-all inside a nest path -> compile-time panic\n#[nest(\"/docs/:..rest\")]\n\n// after: static nest, catch-all on the route\n#[nest(\"/docs\")]\n#[route(\"/:..rest\")]\nDocsRest { rest: Vec<String> },","handlingStrategy":"validation","validationCode":"// Run in a unit test to catch illegal nest paths before the macro panics\n#[test]\nfn nest_paths_have_no_catch_all() {\n    let nest_paths = [\"/docs\", \"/blog\"]; // keep in sync with your Route enum\n    for p in nest_paths {\n        assert!(!p.contains(\":..\"), \"catch-all segment in nest path {p:?} is not allowed\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use static or single :dynamic segments in #[nest(\"...\")] paths; catch-alls belong on #[route] variants","Keep a naming review when refactoring flat catch-all routes into nests","Compile the crate after every route-enum edit — this failure is always compile-time"],"tags":["router","macro","compile-time","catch-all","nest"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}