DioxusLabs/dioxus · error · syn::Error
Async components are not supported
Error message
Async components are not supported
What it means
Validation 3 in validate_component_fn: the #[component] fn is declared async. Dioxus components must be synchronous rendering functions; async work belongs in hooks like use_resource. The faulting input is the async fn declaration.
Solutions
- Components cannot be async. Make the component synchronous and use use_resource or spawn for async work.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core-macro/src/component.rs:477 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/21a202b160f56860.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core-macro/src/component.rs:477
// 1. Ensure the component returns *something*
if item_fn.sig.output == ReturnType::Default {
return Err(Error::new(
item_fn.sig.output.span(),
"Must return a <dioxus_core::Element>".to_string(),
));
}
// 2. make sure there's no lifetimes on the component - we don't know how to handle those
if item_fn.sig.generics.lifetimes().count() > 0 {
return Err(Error::new(
item_fn.sig.generics.span(),
"Lifetimes are not supported in components".to_string(),
));
}
// 3. we can't handle async components
if item_fn.sig.asyncness.is_some() {
return Err(Error::new(
item_fn.sig.asyncness.span(),
"Async components are not supported".to_string(),
));
}
// 4. we can't handle const components
if item_fn.sig.constness.is_some() {
return Err(Error::new(
item_fn.sig.constness.span(),
"Const components are not supported".to_string(),
));
}
// 5. no receiver parameters
if item_fn
.sig
.inputs
.iter()View on GitHub (pinned to 24f6a829df)