neondatabase/neon · error · ApiError
no {param_name} specified in query parameters
Error message
no {param_name} specified in query parameters What it means
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.
Source
Thrown at libs/http-utils/src/request.rs:81
))),
}
})
.transpose()?;
// if values.next().is_some() {
// return Err(ApiError::BadRequest(anyhow!(
// "param {param_name} specified more than once"
// )));
// }
Ok(value1)
}
pub fn must_get_query_param<'a>(
request: &'a Request<Body>,
param_name: &str,
) -> Result<Cow<'a, str>, ApiError> {
get_query_param(request, param_name)?.ok_or_else(|| {
ApiError::BadRequest(anyhow!("no {param_name} specified in query parameters"))
})
}
pub fn parse_query_param<E: fmt::Display, T: FromStr<Err = E>>(
request: &Request<Body>,
param_name: &str,
) -> Result<Option<T>, ApiError> {
get_query_param(request, param_name)?
.map(|v| {
v.parse().map_err(|e| {
ApiError::BadRequest(anyhow!("cannot parse query param {param_name}: {e}"))
})
})
.transpose()
}
pub fn must_parse_query_param<E: fmt::Display, T: FromStr<Err = E>>(
request: &Request<Body>,View on GitHub (pinned to 8f60b04da4)
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
Example fix
# before curl 'http://localhost:9898/v1/tenant/config' # -> 400 no tenant_id specified in query parameters # after curl 'http://localhost:9898/v1/tenant/config?tenant_id=68d532e94ea4d7d' # -> 200
Defensive patterns
Strategy: validation
Validate before calling
// Branch on presence explicitly instead of letting must_get_query_param fail:
match get_query_param(request, "tenant_id")? {
Some(tenant_id) => {
// proceed
}
None => {
return Err(ApiError::BadRequest(anyhow::anyhow!(
"missing required query param 'tenant_id' (example: ?tenant_id=<uuid>)"
)));
}
} Try / catch
match must_get_query_param(request, "tenant_id") {
Ok(v) => v,
Err(e @ ApiError::BadRequest(_)) => {
// map to 400; the message already names the missing parameter
return Err(e);
}
Err(other) => return Err(other),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- param {param_name} specified more than once
- cannot parse query param {param_name}: {e}
- Unexpected request body
- error downloading extension {:?}: {:?}
- Error parsing {remote_endpoint}, expected host:port, got {er
AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16).
Data as JSON: /api/errors/ccf61df1c0703b97.
Report an issue: GitHub.