influxdata/influxdb · error · CatalogError
attempted to create a resource that already exists
Error message
attempted to create a resource that already exists
What it means
CatalogError::AlreadyExists is thrown when an API attempts to create a catalog resource (database, table, token, trigger, cache, etc.) whose name/identifier already exists. It is a typed variant so callers can distinguish duplicate creation from other failures. The catalog treats resource names as unique within their scope.
Solutions
- Check existence first (GET the resource) or handle this variant as success for idempotent flows
- Pick a unique name or delete the existing resource before recreating
- Serialize create operations or rely on the API's idempotency semantics
- Catch CatalogError::AlreadyExists specifically and branch on it
Example fix
// before
let db = catalog.create_database("mydb").await?;
// after
match catalog.create_database("mydb").await {
Ok(db) => db,
Err(CatalogError::AlreadyExists) => catalog.db("mydb").expect("exists"),
Err(e) => return Err(e.into()),
} Defensive patterns
Strategy: try-catch
Validate before calling
// Rust: check existence before create
if catalog.db("mydb").is_ok() {
eprintln!("database mydb already exists");
} Type guard
fn is_already_exists(err: &CatalogError) -> bool {
matches!(err, CatalogError::AlreadyExists)
} Try / catch
match catalog.create_database("mydb").await {
Ok(db) => db,
Err(CatalogError::AlreadyExists) => /* idempotent path */ catalog.db("mydb").unwrap(),
Err(e) => return Err(e.into()),
} Prevention
- Design create calls to be idempotent (treat AlreadyExists as success)
- Avoid duplicate concurrent creation jobs
- Use unique, convention-driven resource names
- Check existence before destructive recreate
When it happens
Trigger: POST /api/v3/configure/database with an existing database name; creating a table with a name already in the database; duplicate token, distinct-cache, last-cache, or trigger creation calls; concurrent create requests racing for the same name.
Common situations: Idempotency-unaware retry logic resending a create request; scripts run twice; two operator processes creating the same resource concurrently; case/name collisions.
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
- attempted to modify resource that was already deleted
- no duplicate table by ID or name
- {0}
- Adding a new database would exceed limit of
- auto field family exists
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/e2d8ac1b09d534db.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_catalog/src/error.rs:50
}
use crate::{
channel::SubscriptionError, format::FeatureLevel, format::FormatError,
log::versions::v4::StorageMode, object_store::ObjectStoreCatalogError,
};
#[derive(Debug, thiserror::Error)]
pub enum CatalogError {
#[error(transparent)]
Enterprise(#[from] EnterpriseCatalogError),
#[error("object store error: {0:?}")]
ObjectStore(#[from] ObjectStoreCatalogError),
#[error("catalog format error: {0}")]
Format(#[from] FormatError),
#[error("attempted to create a resource that already exists")]
AlreadyExists,
#[error("the requested resource was not found: {0}")]
NotFound(String),
#[error("attempted to modify resource that was already deleted: {0}")]
AlreadyDeleted(String),
/// Request is idempotent: no catalog state would change.
#[error("no catalog changes to apply: {details}")]
NoCatalogChange { details: String },
/// Request is invalid.
#[error("catalog internal error: {details}")]
Internal { details: String },
#[error(
"persisted catalog checkpoint sequence {checkpoint_sequence} is ahead of live catalog sequence {live_sequence}"View on GitHub (pinned to 06200ef96b)