influxdata/influxdb · error · Error

tried accessing database that does not exist

Error message

tried accessing database that does not exist

What it means

Signals that an operation tried to access (read from or write through) a database that is not present in the catalog at all. Unlike `DatabaseNotFound`, which carries the missing name, this variant is thrown on access paths where the name isn't available or the lookup simply established the database does not exist.

Solutions

  1. Verify the database exists before accessing it, and create it if needed
  2. Recreate any long-lived clients/handlers after a database drop
  3. Check that configured database names are non-empty and correct

Example fix

// before
let db = buffer.database(&opts.db_name)?; // DbDoesNotExist if typo/empty
// after
if !buffer.database_exists(&opts.db_name) {
    return Err(format!("database {:?} does not exist; create it first", opts.db_name).into());
}
let db = buffer.database(&opts.db_name)?;
Defensive patterns

Strategy: validation

Validate before calling

// guard before any database access
assert!(!db_name.is_empty(), "db name must be non-empty");
assert!(catalog.contains_database(&db_name), "database does not exist");

Prevention

When it happens

Trigger: Internal access paths in the write buffer: getting a database handler by name during writes/queries when the catalog lookup returns nothing — e.g. writes to a never-created or since-dropped database.

Common situations: Stale references held by a long-running client after the database was dropped; routing/templated database names resolving to empty strings; environments where database auto-creation is disabled.

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/da1b7a849ee44ff0. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_write/src/write_buffer/mod.rs:107

    #[error("corrupt load state: {0}")]
    CorruptLoadState(String),

    #[error("database name error: {0}")]
    DatabaseNameError(#[from] DatabaseNameError),

    #[error("error from table buffer: {0}")]
    TableBufferError(#[from] table_buffer::Error),

    #[error("error in last cache: {0}")]
    LastCacheError(#[from] last_cache::Error),

    #[error("database not found {db_name:?}")]
    DatabaseNotFound { db_name: String },

    #[error("table not found {table_name:?} in db {db_name:?}")]
    TableNotFound { db_name: String, table_name: String },

    #[error("tried accessing database that does not exist")]
    DbDoesNotExist,

    #[error("tried creating database named '{0}' that already exists")]
    DatabaseExists(String),

    #[error("cannot write to soft-deleted database '{0}' - it is marked for deletion")]
    DatabaseDeleted(String),

    #[error("tried accessing table that do not exist")]
    TableDoesNotExist,

    #[error("table '{db_name}.{table_name}' already exists")]
    TableAlreadyExists {
        db_name: Arc<str>,
        table_name: Arc<str>,
    },

    #[error("tried accessing column with name ({0}) that does not exist")]

View on GitHub (pinned to 06200ef96b)