influxdata/influxdb · error · Error

table ' . ' already exists

Error message

table '{db_name}.{table_name}' already exists

What it means

Thrown when an operation tries to create a table (measurement) that already exists in the database. Tables are keyed by (db_name, table_name) in the catalog, and duplicate creation is rejected to protect the existing schema.

Solutions

  1. Check for existence first and skip creation if the table is present
  2. Treat this error as success in idempotent bootstrap code
  3. Serialize schema setup so only one process creates tables
  4. Use distinct table names per service if isolation is intended

Example fix

// before
writer.create_table(db, "cpu")?;  // panics/errors on re-run
// after
if !catalog.table_exists(db, "cpu") {
    writer.create_table(db, "cpu")?;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if !catalog.table_exists(db_name, table_name) {
    create_table(db_name, table_name)?;
}

Type guard

fn is_table_already_exists(err: &WriteBufferError) -> bool {
    matches!(err, WriteBufferError::TableAlreadyExists { .. })
}

Try / catch

match create_table(db, table) {
    Err(WriteBufferError::TableAlreadyExists { .. }) => Ok(()), // idempotent
    other => other,
}

Prevention

When it happens

Trigger: Explicit table-creation APIs called twice; a CREATE TABLE-like operation racing with another writer that created the same measurement concurrently.

Common situations: Idempotent setup scripts run repeatedly without checking existence; two services bootstrapping the same schema on startup; retries after a timeout where the first attempt actually succeeded.

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

Appendix: source

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

    #[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(
        "updating catalog on delete of last cache failed, you will need to delete the cache \
        again on server restart"
    )]
    DeleteLastCache(#[source] CatalogError),

    #[error("error from wal: {0}")]
    WalError(#[from] influxdb3_wal::Error),

    #[error("error in distinct value cache: {0}")]

View on GitHub (pinned to 06200ef96b)