{"record":{"id":"1db66eb2f45e9593","repo":"rustfs/rustfs","slug":"key-already-exists-key-id","errorCode":null,"errorMessage":"Key already exists: {key_id}","messagePattern":"Key already exists: (.+?)","errorType":"exception","errorClass":"KmsError::KeyAlreadyExists","httpStatus":null,"severity":"error","filePath":"crates/kms/src/error.rs","lineNumber":55,"sourceCode":"\n    /// Invalid key format or content\n    #[error(\"Invalid key: {message}\")]\n    InvalidKey { message: String },\n\n    /// Cryptographic operation failed\n    #[error(\"Cryptographic error in {operation}: {message}\")]\n    CryptographicError { operation: String, message: String },\n\n    /// Backend communication error\n    #[error(\"Backend error: {message}\")]\n    BackendError { message: String },\n\n    /// Access denied\n    #[error(\"Access denied: {message}\")]\n    AccessDenied { message: String },\n\n    /// Key already exists\n    #[error(\"Key already exists: {key_id}\")]\n    KeyAlreadyExists { key_id: String },\n\n    /// Invalid operation state\n    #[error(\"Invalid operation: {message}\")]\n    InvalidOperation { message: String },\n\n    /// Internal error\n    #[error(\"Internal error: {message}\")]\n    InternalError { message: String },\n\n    /// Serialization/deserialization error\n    #[error(\"Serialization error: {message}\")]\n    SerializationError { message: String },\n\n    /// I/O error\n    #[error(\"I/O error: {message}\")]\n    IoError { message: String },\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/kms/src/error.rs#L37-L73","documentation":"KmsError guard meaning key creation was refused because a key with the same key_id already exists in the backend. It enforces create-idempotency semantics (distinct from overwrite): callers surface 'already exists' to the admin API instead of silently rotating the existing key; the key id is embedded in the message.","triggerScenarios":"Thrown at crates/kms/src/error.rs:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the existing key instead of creating a new one","Pick a different key_id for the new key","Delete the existing key first if replacement is intentional (data encrypted with it becomes unreadable)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}