influxdata/influxdb · error · Error
must specify a 'db' parameter, or provide the database in…
Error message
must specify a 'db' parameter, or provide the database in the InfluxQL query
What it means
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.
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.
Example fix
// before curl 'http://localhost:8181/query' --data-urlencode 'q=SELECT * FROM cpu' // after curl 'http://localhost:8181/query?db=mydb' --data-urlencode 'q=SELECT * FROM cpu'
Defensive patterns
Strategy: validation
Validate before calling
if (!db && !/FROM\s+"[^"]+"\s*\./.test(q)) throw new Error('must provide db parameter or fully-qualified FROM'); Prevention
- 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
When it happens
Trigger: Calling the /query endpoint with only `q=SELECT ... FROM cpu` and no `db` parameter, and the query string does not fully qualify the database.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- must specify a 'db' parameter, or provide the database in…
- Database not found
- datafusion error
- error in InfluxQL statement
- error in InfluxQL statement
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/c42c6fb067f53ee1.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_server/src/http.rs:335
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("query error: {0}")]
Query(#[from] QueryExecutorError),
#[error(transparent)]
DbName(#[from] ValidateDbNameError),
#[error("partial write of line protocol occurred")]
PartialLpWrite(BufferedWriteRequest),
#[error("error in InfluxQL statement: {0}")]
InfluxqlRewrite(#[from] rewrite::Error),
#[error("must provide only one InfluxQl statement per query")]
InfluxqlSingleStatement,
#[error("must specify a 'db' parameter, or provide the database in the InfluxQL query")]
InfluxqlNoDatabase,
#[error(
"provided a database in both the parameters ({param_db}) and \
query string ({query_db}) that do not match, if providing a query \
that specifies the database, you can omit the 'database' parameter \
from your request"
)]
InfluxqlDatabaseMismatch { param_db: String, query_db: String },
#[error("Operation with object store failed: {0}")]
ObjectStore(#[from] object_store::Error),
#[error("heap dump failed: {0}")]
HeapPprof(#[from] jemalloc_pprof_http::Error),
#[error(transparent)]
Catalog(#[from] CatalogError),View on GitHub (pinned to 06200ef96b)