DioxusLabs/dioxus · error · syn::Error

Failed to parse `:`. Hash fragments must be in the format '#

Error message

Failed to parse `:`. Hash fragments must be in the format '#:<field>'

What it means

Error "Failed to parse `:`. Hash fragments must be in the format '#:<field>'" thrown in DioxusLabs/dioxus.

Source

Thrown at packages/router-macro/src/hash.rs:44

        let ident = &self.ident;
        quote! {
            {
                let __hash = #ident.to_string();
                if !__hash.is_empty() {
                    write!(f, "#{}", dioxus_router::exports::percent_encoding::utf8_percent_encode(&__hash, dioxus_router::exports::FRAGMENT_ASCII_SET))?;
                }
            }
        }
    }

    pub fn parse_from_str<'a>(
        route_span: proc_macro2::Span,
        mut fields: impl Iterator<Item = (&'a Ident, &'a Type)>,
        hash: &str,
    ) -> syn::Result<Self> {
        // check if the route has a hash string
        let Some(hash) = hash.strip_prefix(':') else {
            return Err(syn::Error::new(
                route_span,
                "Failed to parse `:`. Hash fragments must be in the format '#:<field>'",
            ));
        };

        let hash_ident = Ident::new(hash, proc_macro2::Span::call_site());
        let field = fields.find(|(name, _)| *name == &hash_ident);

        let ty = if let Some((_, ty)) = field {
            ty.clone()
        } else {
            return Err(syn::Error::new(
                route_span,
                format!("Could not find a field with the name '{}'", hash_ident),
            ));
        };

        Ok(Self {

View on GitHub (pinned to 393d190a80)

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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