DioxusLabs/dioxus · error · syn::Error

Unknown option for component macro

Error message

Unknown option for component macro

What it means

Parse error in ComponentMacroOptions' Parse impl: an identifier in the #[component(...)] attribute's option list is neither `lazy` nor the tolerated legacy `no_case_check`. The faulting input is the unknown option token in the macro attribute.

Solutions

  1. Check the option passed to the #[component] macro for typos and remove or correct it; only documented component options are accepted.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/core-macro/src/component.rs:652 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/9f3eaf03651a187e. Report an issue: GitHub.

Appendix: source

Thrown at packages/core-macro/src/component.rs:652

#[derive(Default)]
pub struct ComponentMacroOptions {
    pub lazy: bool,
}

impl Parse for ComponentMacroOptions {
    fn parse(input: ParseStream) -> Result<Self> {
        let mut lazy_load = false;

        while !input.is_empty() {
            let ident = input.parse::<Ident>()?;
            let ident_name = ident.to_string();
            if ident_name == "lazy" {
                lazy_load = true;
            } else if ident_name == "no_case_check" {
                // we used to have this?
            } else {
                return Err(Error::new(
                    ident.span(),
                    "Unknown option for component macro",
                ));
            }

            if input.peek(Token![,]) {
                input.parse::<Token![,]>()?;
            }
        }

        Ok(Self { lazy: lazy_load })
    }
}

View on GitHub (pinned to 24f6a829df)