{"record":{"id":"3ff8d528f93b201e","repo":"influxdata/influxdb","slug":"database-0-not-found","errorCode":null,"errorMessage":"Database {0} not found","messagePattern":"Database (.+?) not found","errorType":"http","errorClass":"Error::DatabaseNotFound","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":83,"sourceCode":"        from your request\"\n    )]\n    InfluxqlDatabaseMismatch { param_db: String, query_db: String },\n\n    #[error(\n        \"provided a retention policy in both the parameters ({param_rp}) and \\\n        query string ({query_rp}) that do not match, if providing a query \\\n        that specifies the retention_policy, you can omit the 'rp' parameter \\\n        from your request\"\n    )]\n    InfluxqlRetentionPolicyMismatch { param_rp: String, query_rp: String },\n\n    #[error(\"error reading field from body: {name} -- {error}\")]\n    FieldRead { name: &'static str, error: String },\n\n    #[error(\"Cannot retrieve database: {0}\")]\n    Database(DataFusionError),\n\n    #[error(\"Database {0} not found\")]\n    DatabaseNotFound(String),\n\n    #[error(\"v1 query API error: {0}\")]\n    V1Query(#[from] QueryError),\n}\n\n#[derive(Debug, Clone)]\npub enum HttpError {\n    NotFound(String),\n    Unauthorized(String),\n    Invalid(String),\n    InternalError(String),\n}\n\nimpl From<Error> for HttpError {\n    fn from(e: Error) -> Self {\n        use Error::*;\n        use HttpError::*;","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L65-L101","documentation":"Raised by the v1 query API when the database name supplied by the caller (path, parameter, or query) does not correspond to any database known to the server. It is a lookup/validation guard at request handling time, not an IO error — the request is rejected before any query executes. The at-fault input is the database name in the error payload; typical causes are typos, deleted databases, or querying the wrong server.","triggerScenarios":"GET/POST to the v1 /query endpoint with a `db` parameter (or query-qualified database) naming a database that has never been created or has been deleted.","commonSituations":"Typos in the `db` parameter; pointing clients at environments where the database was never provisioned; databases deleted by retention/lifecycle jobs; staging-vs-production naming drift.","solutions":["Verify the exact database name in the error message and correct the `db` parameter.","List available databases (e.g. SHOW DATABASES or the catalog API) and pick the right one.","Create the database if it should exist before querying it.","Fix environment-specific client configuration pointing at the wrong database."],"exampleFix":"// before\nGET /query?db=prod-metrics&q=SELECT+*+FROM+cpu\n// after\nGET /query?db=prod_metrics&q=SELECT+*+FROM+cpu","handlingStrategy":"validation","validationCode":"const KNOWN_DBS = new Set(['prod_metrics', 'staging_metrics']);\nfunction assertDbExists(db) {\n  if (!KNOWN_DBS.has(db)) throw new Error(`database \"${db}\" does not exist`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await queryV1({ db, q });\n} catch (e) {\n  const m = /^Database (.+) not found$/.exec(e.message);\n  if (m) console.error(`check db name: ${m[1]}`);\n  else throw e;\n}","preventionTips":["Fetch the database list at client startup and validate `db` against it.","Use environment-scoped config files instead of hardcoding db names.","Alert on DatabaseNotFound to catch provisioning drift early."],"tags":["database","not-found","query","influxql"],"backgroundTag":"resource-not-found","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"}