{"record":{"id":"18900f73d19bb440","repo":"influxdata/influxdb","slug":"some-entity-that-we-attempted-to-create-already-exists-0","errorCode":null,"errorMessage":"Some entity that we attempted to create already exists: {0}","messagePattern":"Some entity that we attempted to create already exists: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"core/influxdb_iox_client/src/client/error.rs","lineNumber":81,"sourceCode":"#[derive(Error, Debug)]\n#[expect(missing_docs)]\npub enum Error {\n    #[error(\"The operation was cancelled: {0}\")]\n    Cancelled(ServerError<()>),\n\n    #[error(\"Unknown server error: {0}\")]\n    Unknown(ServerError<()>),\n\n    #[error(\"Client specified an invalid argument: {0}\")]\n    InvalidArgument(Box<ServerError<FieldViolation>>),\n\n    #[error(\"Deadline expired before operation could complete: {0}\")]\n    DeadlineExceeded(ServerError<()>),\n\n    #[error(\"{0}\")]\n    NotFound(Box<ServerError<NotFound>>),\n\n    #[error(\"Some entity that we attempted to create already exists: {0}\")]\n    AlreadyExists(Box<ServerError<AlreadyExists>>),\n\n    #[error(\"The caller does not have permission to execute the specified operation: {0}\")]\n    PermissionDenied(ServerError<()>),\n\n    #[error(\"Some resource has been exhausted: {0}\")]\n    ResourceExhausted(ServerError<()>),\n\n    #[error(\"The system is not in a state required for the operation's execution: {0}\")]\n    FailedPrecondition(Box<ServerError<PreconditionViolation>>),\n\n    #[error(\"The operation was aborted: {0}\")]\n    Aborted(ServerError<()>),\n\n    #[error(\"Operation was attempted past the valid range: {0}\")]\n    OutOfRange(ServerError<()>),\n\n    #[error(\"Operation is not implemented or supported: {0}\")]","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/influxdb_iox_client/src/client/error.rs#L63-L99","documentation":"The `Error::AlreadyExists` variant, wrapping a boxed `ServerError<AlreadyExists>`. Raised when the client attempted to create an entity that already exists on the server, mirroring gRPC's ALREADY_EXISTS status with conflict details in the payload.","triggerScenarios":"Creating a table, database/namespace, or other named entity whose name is already taken; replaying an idempotent creation request without an existence check.","commonSituations":"Migration/bootstrapping scripts run twice, concurrent workers racing to create the same resource, tests that don't clean up between runs, name collisions after a rename.","solutions":["Check for existence before creating (or use an upsert/idempotent creation API if available).","Read the AlreadyExists detail to identify the conflicting entity and use a different name if appropriate.","Make idempotent scripts tolerate ALREADY_EXISTS by mapping this variant to a no-op.","Serialize creation across concurrent workers with a lock or leader election."],"exampleFix":"// before\nclient.create_table(\"metrics\", tmpl).await?; // fails on re-run\n// after\nmatch client.create_table(\"metrics\", tmpl).await {\n    Ok(_) | Err(Error::AlreadyExists(_)) => Ok(()), // idempotent\n    Err(e) => Err(e),\n}","handlingStrategy":"try-catch","validationCode":"async fn create_if_absent(client: &Client, name: &str) -> Result<(), Error> {\n    if client.list_tables().await?.contains(&name.to_string()) { return Ok(()); }\n    client.create_table(name, tmpl.clone()).await.map(|_| ())\n}","typeGuard":"fn is_already_exists(e: &Error) -> bool { matches!(e, Error::AlreadyExists(_)) }","tryCatchPattern":"match result {\n    Ok(_) | Err(Error::AlreadyExists(_)) => Ok(()), // treat as success\n    Err(e) => Err(e),\n}","preventionTips":["Make creation paths idempotent — treat ALREADY_EXISTS as success in scripts.","Use unique, deterministic names (e.g. derived from environment+purpose).","Guard concurrent creation with distributed locks or single-leader initialization."],"tags":["grpc","conflict","influxdb"],"backgroundTag":"file-already-exists","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"}