influxdata/influxdb · error · RepositoryError

with id already exists

Error message

{resource} with id {id} already exists

What it means

RepositoryError::AlreadyExists, a validation conflict returned by catalog Repository create/insert operations when an entity with the given id is already registered; `resource` carries the human-readable category (e.g. "database", "table") and `id` the offending key.

Solutions

  1. Check for the existing resource before creating, or use get-or-create semantics
  2. Generate a fresh unique id instead of reusing a deterministic one
  3. If the duplicate is expected, treat it as idempotent success
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at influxdb3_catalog/src/repository.rs:23 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/01a1b845045a1f2d. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog/src/repository.rs:23

use std::cmp::Ordering;
use std::sync::Arc;

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,
    },
}

View on GitHub (pinned to 06200ef96b)