{"record":{"id":"4f67d0537931288c","repo":"influxdata/influxdb","slug":"cannot-retrieve-database-0","errorCode":null,"errorMessage":"Cannot retrieve database: {0}","messagePattern":"Cannot retrieve database: (.+?)","errorType":"http","errorClass":"Error::Database","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":80,"sourceCode":"        \"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(\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 {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L62-L98","documentation":"Thrown when the API cannot retrieve the target database, wrapping a DataFusionError (`Database(DataFusionError)`). Unlike DatabaseNotFound, this means the lookup of the database itself failed inside DataFusion (planning/execution failure), not that the database is simply absent. The wrapped error describes the underlying failure.","triggerScenarios":"Executing a v1 /query request where resolving the database (e.g. listing or opening the namespace/table provider through DataFusion) raises a DataFusionError instead of a clean not-found.","commonSituations":"Backend/catalog errors while opening the namespace; transient storage or catalog failures; DataFusion context misconfiguration after version upgrades.","solutions":["Inspect the wrapped DataFusionError ({0}) for the root cause.","Confirm the catalog/backend serving the database is healthy and reachable.","Retry the request if the failure is transient (storage timeout, etc.).","Verify the database name is well-formed for the target namespace."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function queryDbSafe(db, q, opts = { attempts: 2 }) {\n  for (let i = 0; i < opts.attempts; i++) {\n    try { return await queryV1({ db, q }); }\n    catch (e) {\n      if (/Cannot retrieve database/.test(e.message) && i < opts.attempts - 1) continue;\n      throw e;\n    }\n  }\n}","typeGuard":"function isDbRetrievalError(e) {\n  return e instanceof Error && e.message.startsWith('Cannot retrieve database:');\n}","tryCatchPattern":"try {\n  await queryV1({ db, q });\n} catch (e) {\n  if (/Cannot retrieve database/.test(e.message)) {\n    alertOps('catalog/storage failure resolving database', e);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Monitor catalog/storage backend health before query bursts.","Add bounded retries with backoff for transient lookup failures.","Keep DataFusion and IOx versions aligned after upgrades."],"tags":["database","datafusion","query","internal"],"backgroundTag":"database-query-failed","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"}