{"record":{"id":"863f5043761435e0","repo":"influxdata/influxdb","slug":"missing-query-parameter-db","errorCode":null,"errorMessage":"missing query parameter 'db'","messagePattern":"missing query parameter 'db'","errorType":"http","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":276,"sourceCode":"\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\n    #[error(\"hyper http error: {0}\")]\n    Hyper(#[from] hyper::http::Error),\n\n    /// WriteBuffer error","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L258-L294","documentation":"This error is returned by the HTTP write API (influxdb3_server/src/http.rs) when a write request arrives without the required 'db' query parameter. The server maps it to a 400 Bad Request response so the client knows the request was malformed before it reached the write buffer.","triggerScenarios":"POSTing to the /write or /api/v2/write endpoint without ?db=<database-name> in the URL, e.g. curl -XPOST 'http://host:8181/write' --data-binary 'm v=1'.","commonSituations":"Migrating from v1 setups where the database came from basic-auth or config; building the URL by string concatenation and dropping the query string; proxies or SDKs stripping unknown query params.","solutions":["Add the db query parameter to the write URL: ?db=mydb","Confirm you are using the correct endpoint for your InfluxDB 3 version (v1 /write?db= vs v2 /api/v2/write?org=&bucket=)","Check that any reverse proxy/load balancer is not stripping the query string","Log the full request URL on failure to verify the parameter is present"],"exampleFix":"// before\ncurl -XPOST 'http://localhost:8181/write' --data-binary 'cpu,host=a usage=90'\n// after\ncurl -XPOST 'http://localhost:8181/write?db=mydb' --data-binary 'cpu,host=a usage=90'","handlingStrategy":"validation","validationCode":"if (!url.includes(\"db=\")) { throw new Error(\"write URL must include ?db=<database>\"); }\nconst db = new URL(url).searchParams.get(\"db\");\nif (!db) throw new Error(\"missing 'db' query parameter\");","typeGuard":"function hasDbParam(url) { return new URLSearchParams(url.split(\"?\")[1] ?? \"\").has(\"db\"); }","tryCatchPattern":"try {\n  await res = fetch(writeUrl);\n  if (res.status === 400 && (await res.text()).includes(\"missing query parameter 'db'\")) {\n    // fix URL and retry once with db appended\n  }\n} catch (e) { /* network failure, not this error */ }","preventionTips":["Always build write URLs with a URL builder that includes db explicitly","Add an integration smoke test that performs one write per startup","Never hand-concatenate write URLs from strings","Check InfluxDB 3 API docs for the endpoint's required query params"],"tags":["http","influxdb3","query-parameter","write-api"],"backgroundTag":"invalid-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"}