influxdata/influxdb · error · CatalogError

Database not found

Error message

Database not found {db_name}

What it means

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.

Solutions

  1. Verify the database exists: SHOW DATABASES or the catalog/admin API
  2. Create the database first (CREATE DATABASE {db_name}) or write with implicit creation enabled
  3. Fix the database name in the client/connection configuration (check typos and casing)
  4. Check whether a deletion job or script removed the database

Example fix

// before: wrong name in client config
url = "http://host:8181/write?db=prod_metrics"
// after: name matches created DB
-- SHOW DATABASES -> metrics_prod
url = "http://host:8181/write?db=metrics_prod"
Defensive patterns

Strategy: try-catch

Validate before calling

const dbs = await client.getDatabases();
if (!dbs.includes(dbName)) throw new Error(`DB '${dbName}' does not exist — create it first`);

Type guard

function dbExists(db: string | null | undefined): db is string { return typeof db === 'string' && db.length > 0 && knownDatabases.includes(db); }

Try / catch

try {
  await client.write(dbName, points);
} catch (e) {
  if (/Database not found/.test(String(e.message))) {
    await client.createDatabase(dbName);
    await client.write(dbName, points); // retry once
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/7416bd6ff18ee2e2. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog/src/error.rs:174

    TooManyDbs(usize),

    #[error(
        "Update to schema would exceed the field limit ({limit}) for field family '{field_family}'"
    )]
    TooManyFields { field_family: String, limit: usize },

    #[error("Update to schema would exceed the field family limit of {0}")]
    TooManyFieldFamilies(usize),

    #[error(
        "table '{table_name}' in storage mode {storage_mode:?} cannot allocate more legacy column IDs"
    )]
    LegacyColumnIdsExhausted {
        table_name: Arc<str>,
        storage_mode: StorageMode,
    },

    #[error("Database not found {}", db_name)]
    DatabaseNotFound { db_name: Arc<str> },

    #[error("Table {} not in DB schema for {}", table_name, db_name)]
    TableNotFound {
        db_name: Arc<str>,
        table_name: Arc<str>,
    },

    #[error(
        "Field type mismatch on table {} column {}. Existing column is {} but attempted to add {}",
        table_name,
        column_name,
        existing,
        attempted
    )]
    FieldTypeMismatch {
        table_name: String,
        column_name: String,

View on GitHub (pinned to 06200ef96b)