DioxusLabs/dioxus · error

Catch all segments are not allowed in nests

Error message

Catch all segments are not allowed in nests

What it means

The router macro found a catch-all (...) segment inside a nested route (nest). Catch-all segments can only appear at the top level of a route because a nest's children must remain routable; this validation fires while constructing the route tree.

Solutions

  1. Catch-all segments cannot appear inside nests. Move the catch-all to the end of a top-level route.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/router-macro/src/route_tree.rs:175 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/b324a65ca9a837ae. Report an issue: GitHub.

Appendix: source

Thrown at packages/router-macro/src/route_tree.rs:175

                                },
                                index,
                            };

                            // If it doesn't, add the segment to the current route
                            let static_segment = self.entries.insert(static_segment);

                            let current_children = current_route
                                .map(|id| self.children_mut(id))
                                .unwrap_or_else(|| &mut segments);
                            current_children.push(static_segment);

                            // Update the current route
                            current_route = Some(static_segment);
                        }
                        // If there is a dynamic segment, stop adding static segments
                        RouteSegment::Dynamic(..) => break,
                        RouteSegment::CatchAll(..) => {
                            unimplemented!("Catch all segments are not allowed in nests")
                        }
                    }
                }

                // Add the nest to the current route
                let nest = RouteTreeSegmentData::Nest {
                    nest,
                    children: Vec::new(),
                };

                let nest = self.entries.insert(nest);
                let segments = match current_route.and_then(|id| self.get_mut(id)) {
                    Some(RouteTreeSegmentData::Static { children, .. }) => children,
                    Some(RouteTreeSegmentData::Nest { children, .. }) => children,
                    Some(r) => {
                        unreachable!("{current_route:?}\n{r:?} is not a static or nest segment",)
                    }
                    None => &mut segments,

View on GitHub (pinned to 24f6a829df)