{"record":{"id":"645d1e157da75136","repo":"influxdata/influxdb","slug":"resource-with-name-name-already-exists","errorCode":null,"errorMessage":"{resource} with name '{name}' already exists","messagePattern":"(.+?) with name '(.+?)' already exists","errorType":"exception","errorClass":"RepositoryError","httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/repository.rs","lineNumber":26,"sourceCode":"\nuse ahash::RandomState as AHashBuilder;\nuse influxdb3_id::{CatalogId, SerdeVecMap};\n\nuse crate::CatalogError;\nuse crate::catalog::BiHashMap;\nuse crate::resource::CatalogResource;\n\n/// Error returned by [`Repository`] operations.\n///\n/// Carries the resource label (from [`CatalogResource::CATEGORY`]) and the\n/// offending `id` so the error message is self-identifying without requiring\n/// callers to add context.\n#[derive(thiserror::Error)]\npub enum RepositoryError<I: CatalogId> {\n    #[error(\"{resource} with id {id} already exists\")]\n    AlreadyExists { resource: &'static str, id: I },\n\n    #[error(\"{resource} with name '{name}' already exists\")]\n    AlreadyExistsByName {\n        resource: &'static str,\n        name: String,\n    },\n\n    #[error(\"{resource} with id {id} not found\")]\n    NotFound { resource: &'static str, id: I },\n\n    #[error(\"{resource} with name '{name}' not found\")]\n    NotFoundByName {\n        resource: &'static str,\n        name: String,\n    },\n}\n\n// Manual `Debug` impl so the enum does not impose a `Debug` bound on `I` ---\n// every concrete [`CatalogId`] in this crate derives `Debug`, but the trait\n// itself does not require it.","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/repository.rs#L8-L44","documentation":"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.","triggerScenarios":"Thrown at influxdb3_catalog/src/repository.rs:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Look up the existing resource by name and reuse it rather than creating a new one","Choose a different name for the new resource","Return 409/already-exists semantics to API callers"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}