{"record":{"id":"7416bd6ff18ee2e2","repo":"influxdata/influxdb","slug":"database-not-found-db-name","errorCode":null,"errorMessage":"Database not found {db_name}","messagePattern":"Database not found (.+?)","errorType":"validation","errorClass":"CatalogError","httpStatus":404,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":174,"sourceCode":"    TooManyDbs(usize),\n\n    #[error(\n        \"Update to schema would exceed the field limit ({limit}) for field family '{field_family}'\"\n    )]\n    TooManyFields { field_family: String, limit: usize },\n\n    #[error(\"Update to schema would exceed the field family limit of {0}\")]\n    TooManyFieldFamilies(usize),\n\n    #[error(\n        \"table '{table_name}' in storage mode {storage_mode:?} cannot allocate more legacy column IDs\"\n    )]\n    LegacyColumnIdsExhausted {\n        table_name: Arc<str>,\n        storage_mode: StorageMode,\n    },\n\n    #[error(\"Database not found {}\", db_name)]\n    DatabaseNotFound { db_name: Arc<str> },\n\n    #[error(\"Table {} not in DB schema for {}\", table_name, db_name)]\n    TableNotFound {\n        db_name: Arc<str>,\n        table_name: Arc<str>,\n    },\n\n    #[error(\n        \"Field type mismatch on table {} column {}. Existing column is {} but attempted to add {}\",\n        table_name,\n        column_name,\n        existing,\n        attempted\n    )]\n    FieldTypeMismatch {\n        table_name: String,\n        column_name: String,","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L156-L192","documentation":"Thrown when an operation references a database name that does not exist in the catalog. The catalog looks up the DB schema by name (`db_name`) and returns this error when no entry matches, instead of implicitly creating a database.","triggerScenarios":"Queries, writes, or admin API calls against a database name that was never created or has been deleted; typos in the database name; case/whitespace mismatches.","commonSituations":"Environment mismatch (dev DB name in prod config); database deleted by a retention/cleanup job; client configured with the wrong bucket/database name; race where another actor dropped the DB between calls.","solutions":["Verify the database exists: SHOW DATABASES or the catalog/admin API","Create the database first (CREATE DATABASE {db_name}) or write with implicit creation enabled","Fix the database name in the client/connection configuration (check typos and casing)","Check whether a deletion job or script removed the database"],"exampleFix":"// before: wrong name in client config\nurl = \"http://host:8181/write?db=prod_metrics\"\n// after: name matches created DB\n-- SHOW DATABASES -> metrics_prod\nurl = \"http://host:8181/write?db=metrics_prod\"","handlingStrategy":"try-catch","validationCode":"const dbs = await client.getDatabases();\nif (!dbs.includes(dbName)) throw new Error(`DB '${dbName}' does not exist — create it first`);","typeGuard":"function dbExists(db: string | null | undefined): db is string { return typeof db === 'string' && db.length > 0 && knownDatabases.includes(db); }","tryCatchPattern":"try {\n  await client.write(dbName, points);\n} catch (e) {\n  if (/Database not found/.test(String(e.message))) {\n    await client.createDatabase(dbName);\n    await client.write(dbName, points); // retry once\n  } else throw e;\n}","preventionTips":["Centralize DB names in config/env and validate at startup","Guard cleanup scripts so they never delete databases still referenced by apps","Log the exact db_name on lookup failures to catch typos quickly"],"tags":["database","not-found","catalog","naming"],"backgroundTag":"entity-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"}