{"record":{"id":"0b40e4db69fbb12a","repo":"DioxusLabs/dioxus","slug":"http-method-not-specified-in-macro-or-in-attribute","errorCode":null,"errorMessage":"HTTP method not specified in macro or in attribute","messagePattern":"HTTP method not specified in macro or in attribute","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":737,"sourceCode":"                \"Cannot have multiple query parameters when one is a catch-all\",\n            ));\n        }\n\n        if let Some(options) = route.oapi_options.as_mut() {\n            options.merge_with_fn(function)\n        }\n\n        let method = match (method_from_macro, route.method) {\n            (Some(method), None) => method,\n            (None, Some(method)) => method,\n            (Some(_), Some(_)) => {\n                return Err(syn::Error::new(\n                    Span::call_site(),\n                    \"HTTP method specified both in macro and in attribute\",\n                ));\n            }\n            (None, None) => {\n                return Err(syn::Error::new(\n                    Span::call_site(),\n                    \"HTTP method not specified in macro or in attribute\",\n                ));\n            }\n        };\n\n        Ok(Self {\n            method,\n            route_lit: route.route_lit,\n            path_params: route.path_params,\n            query_params,\n            oapi_options: route.oapi_options,\n            prefix: route.prefix,\n            server_args: route.server_args,\n        })\n    }\n\n    pub fn query_is_catchall(&self) -> bool {","sourceCodeStart":719,"sourceCodeEnd":755,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L719-L755","documentation":"The mirror of the 'specified both' error: the generic `#[route]` macro was used and no HTTP method token was given in the attribute, and no method-specific wrapper (`#[get]` etc.) supplied one either. Dioxus cannot register a handler without a verb, so compilation stops (packages/fullstack-macro/src/lib.rs:736-741).","triggerScenarios":"`#[route(\"/submit\")]` with no method token; `#[route(\"/submit\", summary = \"x\")]` where all arguments are route/oapi fields and the verb was forgotten; deleting a method token while refactoring and not noticing until build.","commonSituations":"Writing a new endpoint and forgetting the verb; assuming a default (e.g. GET) exists — it does not; migrating from axum's `#[axum::routing::get]` style where the verb lives elsewhere.","solutions":["Add a method token to the attribute: `#[route(POST, \"/submit\")]`.","Or switch to a method-named macro: `#[get(\"/items\")]` / `#[post(\"/items\")]`.","Prefer the method-named macros for single-verb handlers — they make omission impossible."],"exampleFix":"// before\n#[route(\"/submit\")]\nasync fn submit(form: Form<Data>) { ... }\n\n// after\n#[route(POST, \"/submit\")]\nasync fn submit(form: Form<Data>) { ... }","handlingStrategy":"validation","validationCode":"# Fail when a generic #[route(...)] attribute has no HTTP method token\nrg -n '#\\[route\\((?![^)]*\\b(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|PATCH)\\b)[^)]*\"' src/ && \\\n  { echo 'ERROR: #[route(...)] without HTTP method'; exit 1; } || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to method-named macros (#[get], #[post]) — omission becomes impossible.","Route literals always carry the verb in code review checklists for new endpoints."],"tags":["dioxus","proc-macro","routes","http-method","compile-time"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}