DioxusLabs/dioxus · error · syn::Error

HTTP method not specified in macro or in attribute

Error message

HTTP method not specified in macro or in attribute

What it means

`from_route` resolves the server function's HTTP method from either the macro options or the route attribute; if neither specifies one, this compile error fires. The developer must declare a method (e.g. `get = "/path"` in the #[server] options or via the route attribute).

Solutions

  1. Specify an HTTP method, e.g. by using #[get(...)]/#[post(...)] or adding the method in the route attribute.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/fullstack-macro/src/lib.rs:737 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/0b40e4db69fbb12a. Report an issue: GitHub.

Appendix: source

Thrown at packages/fullstack-macro/src/lib.rs:737

                "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,
            prefix: route.prefix,
            server_args: route.server_args,
        })
    }

    pub fn query_is_catchall(&self) -> bool {

View on GitHub (pinned to 24f6a829df)