{"record":{"id":"61c299ae45812e51","repo":"influxdata/influxdb","slug":"missing-query-parameter-q","errorCode":null,"errorMessage":"missing query parameter 'q'","messagePattern":"missing query parameter 'q'","errorType":"http","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":272,"sourceCode":"\n    /// The HTTP request method is not supported for this resource\n    #[error(\"unsupported method\")]\n    UnsupportedMethod,\n\n    /// Hyper serving error\n    #[error(\"error serving http: {0}\")]\n    ServingHttp(#[from] hyper::Error),\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db'\")]\n    MissingDeleteDatabaseParams,\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db' and 'q'\")]\n    MissingQueryParams,\n\n    /// Missing the `q` parameter in the v1 /query API\n    #[error(\"missing query parameter 'q'\")]\n    MissingQueryV1Params,\n\n    /// MIssing parameters for write\n    #[error(\"missing query parameter 'db'\")]\n    MissingWriteParams,\n\n    #[error(\"the mime type specified was not valid UTF8: {0}\")]\n    NonUtf8MimeType(#[from] FromUtf8Error),\n\n    /// Serde decode error\n    #[error(\"serde error: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    /// Arrow error\n    #[error(\"arrow error: {0}\")]\n    Arrow(#[from] arrow::error::ArrowError),\n\n    /// Hyper error","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L254-L290","documentation":"This error is specific to the v1 /query compatibility API: the request included (or implied) a database but omitted the required `q` parameter holding the InfluxQL/SQL query text. The server distinguishes this narrower case from the combined missing 'db and q' error so clients get a precise message.","triggerScenarios":"GET /query?db=mydb without `q`; a query string built where `q` was dropped or empty after encoding; client sending SQL in the POST body of an endpoint that only reads the `q` query parameter.","commonSituations":"Migration from InfluxDB 1.x tooling that passes the query differently; shell quoting stripping the q= value; generated URLs with an empty q after templating.","solutions":["Add the `q` parameter: /query?db=mydb&q=SELECT ... (URL-encoded).","Verify `q` is non-empty after interpolation and encoding; check shell quoting around the URL.","If using a client library, pass the query through its query API rather than hand-building the URL.","Consider using the v3 query endpoints (/api/v3/query_sql) if you are not relying on v1 compatibility."],"exampleFix":"// before\nlet url = \"http://localhost:8181/query?db=metrics\";\n// after\nlet url = \"http://localhost:8181/query?db=metrics&q=SELECT%20*%20FROM%20cpu\";","handlingStrategy":"validation","validationCode":"fn validate_v1_query(db: &str, q: &str) -> Result<(), String> {\n    if q.trim().is_empty() { Err(\"missing query parameter 'q'\".into()) }\n    else if db.trim().is_empty() { Err(\"missing query parameter 'db'\".into()) }\n    else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass the query string through proper URL encoding (quotes and spaces break naive URLs).","Verify shell quoting when testing with curl.","Prefer the v3 query API for new code; reserve v1 /query for 1.x-compatibility tooling."],"tags":["http-api","missing-parameter","v1-compatibility","query"],"backgroundTag":"missing-query-parameter","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"}