DioxusLabs/dioxus · error

wildcard path param must be the last path param

Error message

wildcard path param must be the last path param

What it means

`RouteParser::new` validates each path param and errors if a wildcard (`:..name` catch-all) segment appears anywhere except the final position. Since a catch-all consumes all remaining segments, any segment after it could never match, so the route is rejected at compile time.

Solutions

  1. Move the wildcard (catch-all) path parameter to the end of the route; no path params may follow it.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/fullstack-macro/src/lib.rs:1004 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/d708654a384b28fd. Report an issue: GitHub.

Appendix: source

Thrown at packages/fullstack-macro/src/lib.rs:1004

            return Err(syn::Error::new(span, "expected path to start with '/'"));
        }
        let path = path.strip_prefix('/').unwrap();

        let mut path_params = Vec::new();

        for path_param in path.split('/') {
            path_params.push((
                Slash(span),
                PathParam::new(path_param, span, Box::new(parse_quote!(())))?,
            ));
        }

        let path_param_len = path_params.len();
        for (i, (_slash, path_param)) in path_params.iter().enumerate() {
            match path_param {
                PathParam::WildCard(_, _, _, _, _, _) => {
                    if i != path_param_len - 1 {
                        return Err(syn::Error::new(
                            span,
                            "wildcard path param must be the last path param",
                        ));
                    }
                }
                PathParam::Capture(_, _, _, _, _) => (),
                PathParam::Static(lit) => {
                    if lit.value() == "*" && i != path_param_len - 1 {
                        return Err(syn::Error::new(
                            span,
                            "wildcard path param must be the last path param",
                        ));
                    }
                }
            }
        }

        let mut query_params = Vec::new();

View on GitHub (pinned to 24f6a829df)