influxdata/influxdb · error · Error

database name error

Error message

database name error: {0}

What it means

This transparent wrapper (`#[from]`) converts a DatabaseNameError — raised when a database name fails validation (invalid characters, length, reserved names, etc.) — into the write buffer's error type. It occurs when an operation names a database whose name violates catalog naming rules.

Solutions

  1. Validate the database name against influxdb3 naming rules before calling the write API
  2. Trim/strip illegal characters from user- or config-supplied names
  3. Inspect the inner DatabaseNameError for the exact rule violated

Example fix

// before
write_lp("my db/2024", lp)?; // invalid name
// after
let db = "my db/2024".replace([' ', '/'], "_");
validate_db_name(&db)?;
write_lp(&db, lp)?;
Defensive patterns

Strategy: validation

Validate before calling

fn valid_db_name(name: &str) -> bool {
    !name.is_empty()
        && name.len() <= 64
        && name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-')
}
assert!(valid_db_name(&db_name), "invalid database name: {db_name}");

Type guard

fn is_db_name_error(e: &WriteBufferError) -> Option<&DatabaseNameError> {
    match e { WriteBufferError::DatabaseNameError(d) => Some(d), _ => None }
}

Prevention

When it happens

Trigger: Writing to or creating a database with a name containing invalid characters (e.g. spaces, control chars), an empty name, a name that is too long, or otherwise rejected by DatabaseNameError validation.

Common situations: Client-supplied database names passed straight from a user request or config file without sanitization; URL-encoded or templated names containing stray characters; switching from another TSDB whose naming rules are more permissive.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

    EmptyWrite,

    #[error("column type mismatch for column {name}: existing: {existing:?}, new: {new:?}")]
    ColumnTypeMismatch {
        name: String,
        existing: ColumnType,
        new: ColumnType,
    },

    #[error("catalog update error: {0}")]
    CatalogUpdateError(#[from] CatalogError),

    #[error("error from persister: {0}")]
    PersisterError(#[from] PersisterError),

    #[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")]

View on GitHub (pinned to 06200ef96b)