{"record":{"id":"c42c6fb067f53ee1","repo":"influxdata/influxdb","slug":"must-specify-a-db-parameter-or-provide-the-database-in-the-c42c6f","errorCode":null,"errorMessage":"must specify a 'db' parameter, or provide the database in the InfluxQL query","messagePattern":"must specify a 'db' parameter, or provide the database in the InfluxQL query","errorType":"http","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":335,"sourceCode":"    #[error(\"io error: {0}\")]\n    Io(#[from] std::io::Error),\n\n    #[error(\"query error: {0}\")]\n    Query(#[from] QueryExecutorError),\n\n    #[error(transparent)]\n    DbName(#[from] ValidateDbNameError),\n\n    #[error(\"partial write of line protocol occurred\")]\n    PartialLpWrite(BufferedWriteRequest),\n\n    #[error(\"error in InfluxQL statement: {0}\")]\n    InfluxqlRewrite(#[from] rewrite::Error),\n\n    #[error(\"must provide only one InfluxQl statement per query\")]\n    InfluxqlSingleStatement,\n\n    #[error(\"must specify a 'db' parameter, or provide the database in the InfluxQL query\")]\n    InfluxqlNoDatabase,\n\n    #[error(\n        \"provided a database in both the parameters ({param_db}) and \\\n        query string ({query_db}) that do not match, if providing a query \\\n        that specifies the database, you can omit the 'database' parameter \\\n        from your request\"\n    )]\n    InfluxqlDatabaseMismatch { param_db: String, query_db: String },\n\n    #[error(\"Operation with object store failed: {0}\")]\n    ObjectStore(#[from] object_store::Error),\n\n    #[error(\"heap dump failed: {0}\")]\n    HeapPprof(#[from] jemalloc_pprof_http::Error),\n\n    #[error(transparent)]\n    Catalog(#[from] CatalogError),","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L317-L353","documentation":"Raised when an InfluxQL request arrives without any database specified. The server needs a target database either via the `db` query parameter or embedded in the query itself (e.g. `SELECT ... FROM \"mydb\".\"autogen\".cpu`), and neither was present.","triggerScenarios":"Calling the /query endpoint with only `q=SELECT ... FROM cpu` and no `db` parameter, and the query string does not fully qualify the database.","commonSituations":"Copied curl examples that omit db; clients that in 1.x defaulted to a configured database; environment-specific configs where the db parameter was lost.","solutions":["Add the `db` query parameter to the request URL.","Or fully qualify the database in the query: SELECT * FROM \"mydb\".\"autogen\".cpu.","Fix client/driver configuration so the default database is passed through."],"exampleFix":"// before\ncurl 'http://localhost:8181/query' --data-urlencode 'q=SELECT * FROM cpu'\n// after\ncurl 'http://localhost:8181/query?db=mydb' --data-urlencode 'q=SELECT * FROM cpu'","handlingStrategy":"validation","validationCode":"if (!db && !/FROM\\s+\"[^\"]+\"\\s*\\./.test(q)) throw new Error('must provide db parameter or fully-qualified FROM');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set the db parameter in every request by default in your client wrapper","Fully qualify measurements as \"db\".\"rp\".\"measurement\" when omitting db","Document the required db parameter for teams migrating from 1.x defaults"],"tags":["influxql","query","missing-parameter"],"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"}