influxdata/influxdb · error · CatalogError

token name already exists

Error message

token name already exists, {0}

What it means

This error is thrown when attempting to create a new API token whose name collides with an existing token name in the catalog. Token names are unique, and the offending requested name is included in the message.

Solutions

  1. Choose a unique token name (the message names the conflicting one)
  2. List existing tokens and delete/rename the old one if it is no longer needed
  3. Make scripted token names unique (timestamp or run ID suffix)
  4. Reuse the existing token's credentials instead of creating a duplicate

Example fix

// before
create_token("ci-token", permissions)?;
// after
let name = format!("ci-token-{}", chrono::Utc::now().timestamp());
create_token(&name, permissions)?;
Defensive patterns

Strategy: try-catch

Validate before calling

fn token_name_available(catalog: &Catalog, name: &str) -> bool {
    !catalog.iter_tokens().any(|t| t.name == name)
}

Try / catch

match create_token(name, perms) {
    Err(CatalogError::TokenNameAlreadyExists(existing)) => {
        // reuse existing token or pick a new name
    },
    r => r,
}

Prevention

When it happens

Trigger: Calling token-creation APIs (e.g. `create_token`) or the `influxdb3 create token` command with a name that already exists in the catalog.

Common situations: Re-running provisioning scripts without changing token names; forgetting a previously created token with the same name; CI pipelines generating tokens with fixed names.

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

Appendix: source

Thrown at influxdb3_catalog/src/error.rs:282

    #[error("failed to parse trigger from {}", trigger_spec)]
    ProcessingEngineTriggerSpecParseError { trigger_spec: String },

    #[error("last cache size must be greater than 0")]
    InvalidLastCacheSize,

    #[error("failed to parse trigger from {trigger_spec}{}", .context.as_ref().map(|context| format!(": {context}")).unwrap_or_default())]
    TriggerSpecificationParseError {
        trigger_spec: String,
        context: Option<String>,
    },

    #[error("invalid error behavior {0}")]
    InvalidErrorBehavior(String),

    #[error("cannot parse token permission, {0}")]
    CannotParsePermissionForToken(String),

    #[error("token name already exists, {0}")]
    TokenNameAlreadyExists(String),

    #[error("token hash already exists")]
    TokenHashAlreadyExists,

    #[error("missing admin token, cannot update")]
    MissingAdminTokenToUpdate,

    #[error("cannot delete internal db")]
    CannotDeleteInternalDatabase,

    #[error("cannot modify internal db")]
    CannotModifyInternalDatabase,

    #[error("tried to stop a node ({node_id}) that is already stopped")]
    NodeAlreadyStopped { node_id: Arc<str> },

    #[error(

View on GitHub (pinned to 06200ef96b)