influxdata/influxdb · error · RepositoryError

with name ' ' already exists

Error message

{resource} with name '{name}' already exists

What it means

RepositoryError::AlreadyExistsByName, the name-keyed counterpart of AlreadyExists: a catalog Repository insert found an existing resource with the same human-readable name; `resource` names the category and `name` the colliding name.

Solutions

  1. Look up the existing resource by name and reuse it rather than creating a new one
  2. Choose a different name for the new resource
  3. Return 409/already-exists semantics to API callers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at influxdb3_catalog/src/repository.rs:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at influxdb3_catalog/src/repository.rs:26

use ahash::RandomState as AHashBuilder;
use influxdb3_id::{CatalogId, SerdeVecMap};

use crate::CatalogError;
use crate::catalog::BiHashMap;
use crate::resource::CatalogResource;

/// Error returned by [`Repository`] operations.
///
/// Carries the resource label (from [`CatalogResource::CATEGORY`]) and the
/// offending `id` so the error message is self-identifying without requiring
/// callers to add context.
#[derive(thiserror::Error)]
pub enum RepositoryError<I: CatalogId> {
    #[error("{resource} with id {id} already exists")]
    AlreadyExists { resource: &'static str, id: I },

    #[error("{resource} with name '{name}' already exists")]
    AlreadyExistsByName {
        resource: &'static str,
        name: String,
    },

    #[error("{resource} with id {id} not found")]
    NotFound { resource: &'static str, id: I },

    #[error("{resource} with name '{name}' not found")]
    NotFoundByName {
        resource: &'static str,
        name: String,
    },
}

// Manual `Debug` impl so the enum does not impose a `Debug` bound on `I` ---
// every concrete [`CatalogId`] in this crate derives `Debug`, but the trait
// itself does not require it.

View on GitHub (pinned to 06200ef96b)