influxdata/influxdb · error · Error::MissingQueryParams
missing query parameters 'db' and 'q'
Error message
missing query parameters 'db' and 'q'
What it means
`Error::MissingQueryParams` is a fieldless variant thrown when a query request lacks the required `db` and `q` parameters. The v1 API requires both the database name and the query string; if either is absent this error is returned instead of executing a query.
Solutions
- Include both `db` and `q` in the request (query string for GET, urlencoded body for POST).
- Ensure parameter values are non-empty and properly URL-encoded.
- Validate the request client-side before sending.
Example fix
// before
client.get("/query").send().await?
// after
client.get("/query").query(&[("db", "mydb"), ("q", "SELECT 1")]).send().await? Defensive patterns
Strategy: validation
Validate before calling
fn query_params_ok(db: &str, q: &str) -> bool {
!db.trim().is_empty() && !q.trim().is_empty()
} Type guard
fn is_missing_params(e: &iox_v1_query_api::Error) -> bool {
matches!(e, iox_v1_query_api::Error::MissingQueryParams)
} Try / catch
assert!(query_params_ok(db, q), "db and q are required");
let resp = client.get("/query")
.query(&[("db", db), ("q", q)])
.send().await?; Prevention
- Build requests with a typed query struct so missing fields fail at compile time.
- Trim and check inputs for emptiness before sending.
- Document required parameters in the shared client API surface.
When it happens
Trigger: GET /query without `db` and/or `q` query-string parameters, or a POST whose decoded body does not yield both parameters.
Common situations: Hand-built URLs that forget to URL-encode/append parameters, clients sending only the query but not the database, or empty `q=` / `db=` values treated as missing.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- authorization failure
- error decoding multipart file upload
- error decoding params from url
- error decoding query body
- invalid mime type ( )
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/0a15bc1e22202f58.
Report an issue: GitHub.
Appendix: source
Thrown at core/iox_v1_query_api/src/error.rs:29
/// that process it will result in a 500 INTERNAL ERROR.
#[derive(Debug, thiserror::Error)]
#[error("unexpected query error: {0}")]
pub struct QueryError(#[from] pub anyhow::Error);
#[derive(Debug, Error)]
pub enum Error {
/// The requested path has no registered handler.
#[error("not found: {0}")]
NoHandler(String),
#[error("authorization failure: {0}")]
AuthorizationFailure(String),
#[error("invalid mime type ({0})")]
InvalidMimeType(String),
/// Missing parameters for query
#[error("missing query parameters 'db' and 'q'")]
MissingQueryParams,
#[error("error decoding multipart file upload: {0}")]
MultipartFile(String),
#[error("Invalid UTF8: {message} {error}")]
Utf8 {
message: &'static str,
error: String,
},
/// Serde decode error
#[error("error decoding params from url: {0}")]
SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),
// SerdeJsonError
#[error("error decoding query body: {0}")]
SerdeJson(#[from] serde_json::Error),View on GitHub (pinned to 06200ef96b)