{"record":{"id":"0a15bc1e22202f58","repo":"influxdata/influxdb","slug":"missing-query-parameters-db-and-q","errorCode":null,"errorMessage":"missing query parameters 'db' and 'q'","messagePattern":"missing query parameters 'db' and 'q'","errorType":"validation","errorClass":"Error::MissingQueryParams","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":29,"sourceCode":"/// that process it will result in a 500 INTERNAL ERROR.\n#[derive(Debug, thiserror::Error)]\n#[error(\"unexpected query error: {0}\")]\npub struct QueryError(#[from] pub anyhow::Error);\n\n#[derive(Debug, Error)]\npub enum Error {\n    /// The requested path has no registered handler.\n    #[error(\"not found: {0}\")]\n    NoHandler(String),\n\n    #[error(\"authorization failure: {0}\")]\n    AuthorizationFailure(String),\n\n    #[error(\"invalid mime type ({0})\")]\n    InvalidMimeType(String),\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db' and 'q'\")]\n    MissingQueryParams,\n\n    #[error(\"error decoding multipart file upload: {0}\")]\n    MultipartFile(String),\n\n    #[error(\"Invalid UTF8: {message} {error}\")]\n    Utf8 {\n        message: &'static str,\n        error: String,\n    },\n\n    /// Serde decode error\n    #[error(\"error decoding params from url: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    // SerdeJsonError\n    #[error(\"error decoding query body: {0}\")]\n    SerdeJson(#[from] serde_json::Error),","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L11-L47","documentation":"`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.","triggerScenarios":"GET /query without `db` and/or `q` query-string parameters, or a POST whose decoded body does not yield both parameters.","commonSituations":"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.","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."],"exampleFix":"// before\nclient.get(\"/query\").send().await?\n// after\nclient.get(\"/query\").query(&[(\"db\", \"mydb\"), (\"q\", \"SELECT 1\")]).send().await?","handlingStrategy":"validation","validationCode":"fn query_params_ok(db: &str, q: &str) -> bool {\n    !db.trim().is_empty() && !q.trim().is_empty()\n}","typeGuard":"fn is_missing_params(e: &iox_v1_query_api::Error) -> bool {\n    matches!(e, iox_v1_query_api::Error::MissingQueryParams)\n}","tryCatchPattern":"assert!(query_params_ok(db, q), \"db and q are required\");\nlet resp = client.get(\"/query\")\n    .query(&[(\"db\", db), (\"q\", q)])\n    .send().await?;","preventionTips":["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."],"tags":["rust","http-api","missing-parameters","query-string","thiserror"],"backgroundTag":"missing-required-argument","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}