{"record":{"id":"c6356c302db75f6f","repo":"DioxusLabs/dioxus","slug":"cannot-have-multiple-query-parameters-when-one-is","errorCode":null,"errorMessage":"Cannot have multiple query parameters when one is a catch-all","messagePattern":"Cannot have multiple query parameters when one is a catch-all","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":717,"sourceCode":"                    param.binding.span(),\n                    format!(\n                        \"query parameter `{}` not found in function arguments\",\n                        param.binding\n                    ),\n                )\n            })?;\n            query_params.push(QueryParam {\n                binding: ident,\n                name: param.name,\n                catch_all: param.catch_all,\n                ty: ty.0,\n                arg_idx: ty.1,\n            });\n        }\n\n        // Disallow multiple query params if one is a catch-all\n        if query_params.iter().any(|param| param.catch_all) && query_params.len() > 1 {\n            return Err(syn::Error::new(\n                Span::call_site(),\n                \"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            }","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L699-L735","documentation":"A dioxus-fullstack route string may declare several query parameters, but at most one of them may be a catch-all (`:name` or `{name}` syntax in the query section). A catch-all consumes the remaining query pairs, so mixing it with other query params is ambiguous and rejected at compile time (packages/fullstack-macro/src/lib.rs:714).","triggerScenarios":"`#[route(GET, \"/list?page&:filters\")]` — one normal param `page` plus catch-all `filters`; likewise `\"/list?page&{filters}\"`. Any route string where `query.split('&')` yields 2+ entries and at least one starts with `:` or is wrapped in `{}`.","commonSituations":"Wanting pagination plus an open-ended filter bag in one endpoint; migrating an axum handler that deserialized a struct with `HashMap<String, String>` flatten alongside scalar params; misusing `{name}` (intended for catch-all) instead of plain `name` for a normal query param.","solutions":["Keep only the catch-all and fold all query data into it, e.g. `#[route(GET, \"/list?:filters\")]` with `filters: HashMap<String, String>`.","Or drop the catch-all and list every param explicitly: `/list?page&per_page`.","Remember plain query params are written bare (`page`) or as `url_name=binding`; `{name}`/`:name` mean catch-all — switch the syntax if you did not intend a catch-all."],"exampleFix":"// before\n#[route(GET, \"/list?page&:filters\")]\nasync fn list(page: usize, filters: HashMap<String, String>) { ... }\n\n// after\n#[route(GET, \"/list?filters\")]\nasync fn list(filters: HashMap<String, String>) { ... }","handlingStrategy":"validation","validationCode":"def check_query(route: str):\n    q = route.split('?', 1)[1] if '?' in route else ''\n    segs = [s for s in q.split('&') if s]\n    catchalls = [s for s in segs if s.startswith(':') or (s.startswith('{') and s.endswith('}'))]\n    assert not (catchalls and len(segs) > 1), f'catch-all mixed with other query params in {route!r}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve `:name`/`{name}` query syntax exclusively for catch-alls; plain params stay bare.","If you need filters plus pagination, put all of it into one HashMap catch-all instead of mixing."],"tags":["dioxus","proc-macro","routes","query-params","catch-all","compile-time"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}