DioxusLabs/dioxus · error · syn::Error

Could not find a field with the name '{}'

Error message

Could not find a field with the name '{}'

What it means

Error "Could not find a field with the name '{}'" thrown in DioxusLabs/dioxus.

Source

Thrown at packages/router-macro/src/segment.rs:193

        ));
    }

    while let Some(segment) = iterator.next() {
        if let Some(segment) = segment.strip_prefix(':') {
            let spread = segment.starts_with("..");

            let ident = if spread {
                segment[2..].to_string()
            } else {
                segment.to_string()
            };

            let field = fields.clone().find(|(name, _)| **name == ident);

            let ty = if let Some(field) = field {
                field.1.clone()
            } else {
                return Err(syn::Error::new(
                    route_span,
                    format!("Could not find a field with the name '{}'", ident,),
                ));
            };
            if spread {
                route_segments.push(RouteSegment::CatchAll(
                    Ident::new(&ident, Span::call_site()),
                    ty,
                ));

                if iterator.next().is_some() {
                    return Err(syn::Error::new(
                        route_span,
                        "Catch-all route segments must be the last segment in a route. The route segments after the catch-all segment will never be matched.",
                    ));
                } else {
                    break;
                }

View on GitHub (pinned to 393d190a80)

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16). Data as JSON: /api/errors/df0b2fe39985a193. Report an issue: GitHub.