DioxusLabs/dioxus · error · syn::Error

path parameter ` ` not found in function arguments

Error message

path parameter `{}` not found in function arguments

What it means

Thrown by the server-function route macro when a path segment declared in the route string (e.g. /users/{id}) does not match any typed argument of the annotated function. The macro builds a map of function argument names and removes entries as path params are matched; a leftover route param means the fn signature is missing that parameter.

Solutions

  1. Add a function argument whose name matches the path parameter, or rename/remove the `{param}` segment in the route path so they agree.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        let mut arg_map = sig
            .inputs
            .iter()
            .enumerate()
            .filter_map(|(i, item)| match item {
                syn::FnArg::Receiver(_) => None,
                syn::FnArg::Typed(pat_type) => Some((i, pat_type)),
            })
            .filter_map(|(i, pat_type)| match &*pat_type.pat {
                syn::Pat::Ident(ident) => Some((ident.ident.clone(), (pat_type.ty.clone(), i))),
                _ => None,
            })
            .collect::<HashMap<_, _>>();

        for (_slash, path_param) in &mut route.path_params {
            match path_param {
                PathParam::Capture(_lit, _, ident, ty, _) => {
                    let (new_ident, new_ty) = arg_map.remove_entry(ident).ok_or_else(|| {
                        syn::Error::new(
                            ident.span(),
                            format!("path parameter `{}` not found in function arguments", ident),
                        )
                    })?;
                    *ident = new_ident;
                    *ty = new_ty.0;
                }
                PathParam::WildCard(_lit, _, _star, ident, ty, _) => {
                    let (new_ident, new_ty) = arg_map.remove_entry(ident).ok_or_else(|| {
                        syn::Error::new(
                            ident.span(),
                            format!("path parameter `{}` not found in function arguments", ident),
                        )
                    })?;
                    *ident = new_ident;
                    *ty = new_ty.0;
                }
                PathParam::Static(_lit) => {}

View on GitHub (pinned to 24f6a829df)