DioxusLabs/dioxus · error · syn::Error
HTTP method specified both in macro and in attribute
Error message
HTTP method specified both in macro and in attribute
What it means
The HTTP verb was supplied twice: once in the macro invocation (e.g. #[server(GET)]) and once in the route attribute (#[route(..., method = ...)]). The macro refuses to pick between two conflicting sources for the same method.
Solutions
- Specify the HTTP method in exactly one place: either in the macro (e.g. #[get]) or in the attribute, not both.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/fullstack-macro/src/lib.rs:731 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/fd49c5a9a0299315.
Report an issue: GitHub.
Appendix: source
Thrown at packages/fullstack-macro/src/lib.rs:731
}
// Disallow multiple query params if one is a catch-all
if query_params.iter().any(|param| param.catch_all) && query_params.len() > 1 {
return Err(syn::Error::new(
Span::call_site(),
"Cannot have multiple query parameters when one is a catch-all",
));
}
if let Some(options) = route.oapi_options.as_mut() {
options.merge_with_fn(function)
}
let method = match (method_from_macro, route.method) {
(Some(method), None) => method,
(None, Some(method)) => method,
(Some(_), Some(_)) => {
return Err(syn::Error::new(
Span::call_site(),
"HTTP method specified both in macro and in attribute",
));
}
(None, None) => {
return Err(syn::Error::new(
Span::call_site(),
"HTTP method not specified in macro or in attribute",
));
}
};
Ok(Self {
method,
route_lit: route.route_lit,
path_params: route.path_params,
query_params,
oapi_options: route.oapi_options,View on GitHub (pinned to 24f6a829df)