influxdata/influxdb · warning · Error

tried creating database named

Error message

tried creating database named '{0}' that already exists

What it means

Thrown when an operation tries to create a database whose name is already taken by an existing database in the catalog. The payload is the conflicting name. It prevents silently reusing or clobbering an existing database's schema and data.

Solutions

  1. Check existence first and treat create as idempotent (skip if it exists)
  2. Catch the error and fall back to using the existing database
  3. Serialize database creation (single provisioner) to avoid races

Example fix

// before
create_database("metrics")?; // fails on second run
// after
if let Err(WriteBufferError::DatabaseExists(name)) = create_database("metrics") {
    log::info!("database {name} already exists; reusing it");
}
Defensive patterns

Strategy: try-catch

Validate before calling

// idempotent creation
if !database_exists(name)? {
    create_database(name)?;
}

Type guard

fn is_database_exists(e: &WriteBufferError) -> bool {
    matches!(e, WriteBufferError::DatabaseExists(_))
}

Try / catch

match create_database(name) {
    Err(WriteBufferError::DatabaseExists(n)) => info!("db {n} already exists, reusing"),
    other => other?,
}

Prevention

When it happens

Trigger: Explicit database-creation requests (API or write-buffer create_database) for a name that already exists; racing duplicate create calls from multiple clients or startup initialization running twice.

Common situations: Idempotency mistakes in provisioning scripts run more than once; two services starting up and both creating the same default database; assuming create is upsert-like when it is not.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

    #[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")]
    ColumnDoesNotExist(String),

    #[error(

View on GitHub (pinned to 06200ef96b)