{"record":{"id":"ccf61df1c0703b97","repo":"neondatabase/neon","slug":"no-param-name-specified-in-query-parameters","errorCode":null,"errorMessage":"no {param_name} specified in query parameters","messagePattern":"no (.+?) specified in query parameters","errorType":"http","errorClass":"ApiError","httpStatus":400,"severity":"error","filePath":"libs/http-utils/src/request.rs","lineNumber":81,"sourceCode":"                ))),\n            }\n        })\n        .transpose()?;\n    // if values.next().is_some() {\n    //     return Err(ApiError::BadRequest(anyhow!(\n    //         \"param {param_name} specified more than once\"\n    //     )));\n    // }\n\n    Ok(value1)\n}\n\npub fn must_get_query_param<'a>(\n    request: &'a Request<Body>,\n    param_name: &str,\n) -> Result<Cow<'a, str>, ApiError> {\n    get_query_param(request, param_name)?.ok_or_else(|| {\n        ApiError::BadRequest(anyhow!(\"no {param_name} specified in query parameters\"))\n    })\n}\n\npub fn parse_query_param<E: fmt::Display, T: FromStr<Err = E>>(\n    request: &Request<Body>,\n    param_name: &str,\n) -> Result<Option<T>, ApiError> {\n    get_query_param(request, param_name)?\n        .map(|v| {\n            v.parse().map_err(|e| {\n                ApiError::BadRequest(anyhow!(\"cannot parse query param {param_name}: {e}\"))\n            })\n        })\n        .transpose()\n}\n\npub fn must_parse_query_param<E: fmt::Display, T: FromStr<Err = E>>(\n    request: &Request<Body>,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/libs/http-utils/src/request.rs#L63-L99","documentation":"Returned by must_get_query_param when the named query parameter is absent from the request (no query string at all, or the key is not present in it). It converts the None from get_query_param into ApiError::BadRequest, so the client receives HTTP 400 with the message naming the missing parameter.","triggerScenarios":"Calling an endpoint whose handler uses must_get_query_param without supplying that parameter: 'GET /v1/tenant/config' without '?tenant_id=...', or when the parameter is misspelled ('tenantId' vs 'tenant_id'), placed in the URL fragment after '#', or sent in a request body instead of the query string.","commonSituations":"Script typos or wrong-case parameter names; a client from an older API version using a renamed parameter; parameters accidentally serialized into a JSON body of a GET request; URLs that lost their query string through shell escaping or truncation.","solutions":["Add the parameter to the query string using the exact spelling shown in the error message","Check the endpoint's handler or API docs for the list of required query parameters","If the parameter is genuinely optional in your flow, call get_query_param (returns Option) instead of must_get_query_param","When wrapping this library in your own service, map ApiError::BadRequest to a 400 response that echoes which parameter is missing"],"exampleFix":"# before\ncurl 'http://localhost:9898/v1/tenant/config'\n# -> 400 no tenant_id specified in query parameters\n\n# after\ncurl 'http://localhost:9898/v1/tenant/config?tenant_id=68d532e94ea4d7d'\n# -> 200","handlingStrategy":"validation","validationCode":"// Branch on presence explicitly instead of letting must_get_query_param fail:\nmatch get_query_param(request, \"tenant_id\")? {\n    Some(tenant_id) => {\n        // proceed\n    }\n    None => {\n        return Err(ApiError::BadRequest(anyhow::anyhow!(\n            \"missing required query param 'tenant_id' (example: ?tenant_id=<uuid>)\"\n        )));\n    }\n}","typeGuard":null,"tryCatchPattern":"match must_get_query_param(request, \"tenant_id\") {\n    Ok(v) => v,\n    Err(e @ ApiError::BadRequest(_)) => {\n        // map to 400; the message already names the missing parameter\n        return Err(e);\n    }\n    Err(other) => return Err(other),\n}","preventionTips":["Keep a per-endpoint table of required query parameters and validate in one place before dispatch","Generate client bindings from the route definitions so omitted parameters are compile errors","In e2e tests, hit every route once with no query string and assert the 400 names the right parameter","Prefer must_parse_query_param with a typed parameter so absent-vs-malformed are distinguishable in logs"],"tags":["rust","http","query-params","bad-request","validation"],"backgroundTag":"missing-required-query-parameter","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}