DioxusLabs/dioxus · error
Self type is not supported
Error message
Self type is not supported
What it means
A fullstack route/middleware macro was applied to a method with a self receiver. The generated server-function plumbing does not support Self types, so encountering FnArg::Receiver in the argument list panics inside route_impl_with_route.
Solutions
- Server function signatures cannot use Self. Name the concrete type explicitly.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/fullstack-macro/src/lib.rs:235 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/5f0a13de9d27a7b1.
Report an issue: GitHub.
Appendix: source
Thrown at packages/fullstack-macro/src/lib.rs:235
f.span(),
"Expected middleware attribute to be a list, e.g. #[middleware(MyLayer::new())]",
)),
})
.collect::<Result<Vec<_>>>()?;
// don't re-emit the middleware attribute on the inner
function
.attrs
.retain(|attr| !attr.path().is_ident("middleware"));
// Attach `#[allow(unused_mut)]` to all original inputs to avoid warnings
let outer_inputs = function
.sig
.inputs
.iter()
.enumerate()
.map(|(i, arg)| match arg {
FnArg::Receiver(_receiver) => panic!("Self type is not supported"),
FnArg::Typed(pat_type) => match pat_type.pat.as_ref() {
Pat::Ident(_) => {
quote! { #[allow(unused_mut)] #pat_type }
}
_ => {
let ident = format_ident!("___Arg{}", i);
let ty = &pat_type.ty;
quote! { #[allow(unused_mut)] #ident: #ty }
}
},
})
.collect::<Punctuated<_, Token![,]>>();
// .collect::<Punctuated<_, Token![,]>>();
let route = CompiledRoute::from_route(route, &function, false, method_from_macro)?;
let query_params_struct = route.query_params_struct(false);
let method_ident = &route.method;
let body_json_args = route.remaining_pattypes_named(&function.sig.inputs);View on GitHub (pinned to 24f6a829df)