{"record":{"id":"c7529effbf65eac1","repo":"influxdata/influxdb","slug":"missing-query-parameters-db-and-q-http","errorCode":null,"errorMessage":"missing query parameters 'db' and 'q'","messagePattern":"missing query parameters 'db' and 'q'","errorType":"http","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":268,"sourceCode":"\n    /// The provided authorization is not sufficient to perform the request.\n    #[error(\"access denied\")]\n    Forbidden,\n\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","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L250-L286","documentation":"This error indicates a query request was missing both required query parameters: `db` (the target database) and `q` (the query text). The server validates both before executing anything and reports exactly which parameters were absent via this message.","triggerScenarios":"GET/POST to the query endpoint (/query or /api/v3/query_sql legacy surface) with neither `db` nor `q` in the query string or form body — e.g. an empty GET request or a POST with the wrong content type so parameters were not parsed.","commonSituations":"Opening the query endpoint directly in a browser with no parameters; sending parameters as a JSON body to an endpoint that only reads the URL query string; URL built by concatenation that dropped everything after '?'.","solutions":["Include both parameters: ?db=mydb&q=SELECT%20*%20FROM%20measurement.","URL-encode the SQL in `q` (spaces, quotes, operators) so the query string parses correctly.","If POSTing, send parameters as application/x-www-form-urlencoded or in the query string, per the API contract.","Check the endpoint path matches your server version's query API."],"exampleFix":"// before\nlet url = \"http://localhost:8181/query\";\n// after\nlet url = \"http://localhost:8181/query?db=metrics&q=SELECT%20*%20FROM%20cpu\";","handlingStrategy":"validation","validationCode":"fn build_query_url(base: &str, db: &str, q: &str) -> String {\n    assert!(!db.is_empty(), \"db is required\");\n    assert!(!q.is_empty(), \"q is required\");\n    format!(\"{base}?db={}&q={}\", urlencode(db), urlencode(q))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["URL-encode both parameters, especially the SQL text.","Use a URL builder rather than string concatenation.","Send POST form parameters as application/x-www-form-urlencoded when the endpoint supports it."],"tags":["http-api","missing-parameter","query","query-string"],"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"}