{"record":{"id":"750e2b9172ee6dfe","repo":"rustfs/rustfs","slug":"user-0-does-not-exist","errorCode":null,"errorMessage":"user '{0}' does not exist","messagePattern":"user '(.+?)' does not exist","errorType":"exception","errorClass":"Error::NoSuchUser","httpStatus":null,"severity":"error","filePath":"crates/iam/src/error.rs","lineNumber":35,"sourceCode":"use std::sync::Arc;\n\npub type Result<T> = core::result::Result<T, Error>;\n\n#[derive(thiserror::Error, Debug)]\npub enum Error {\n    // Arc payloads keep Clone variant-preserving for the non-cloneable inner\n    // errors (backlog#1831 PR2). Display is unchanged; the source() chain is\n    // not forwarded (Arc<E> does not implement std::error::Error).\n    #[error(\"{0}\")]\n    PolicyError(Arc<PolicyError>),\n\n    #[error(\"{0}\")]\n    StringError(String),\n\n    #[error(\"crypto: {0}\")]\n    CryptoError(Arc<rustfs_crypto::Error>),\n\n    #[error(\"user '{0}' does not exist\")]\n    NoSuchUser(String),\n\n    #[error(\"account '{0}' does not exist\")]\n    NoSuchAccount(String),\n\n    #[error(\"service account '{0}' does not exist\")]\n    NoSuchServiceAccount(String),\n\n    #[error(\"temp account '{0}' does not exist\")]\n    NoSuchTempAccount(String),\n\n    #[error(\"group '{0}' does not exist\")]\n    NoSuchGroup(String),\n\n    #[error(\"policy does not exist\")]\n    NoSuchPolicy,\n\n    #[error(\"policy in use\")]","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/iam/src/error.rs#L17-L53","documentation":"Error::NoSuchUser(String) (crates/iam/src/error.rs:35) is the IAM layer's 404-class miss for a named user/access key: returned when a user record lookup fails in the IAM store — manager.rs:741/1257/1549-1682/2546-2570 (credential lookup, status change, group membership ops) and store/object.rs identity-file misses (607-642/923/1329). The Display embeds the access key that was not found. sys.rs:551/561 also returns it from user-info paths.","triggerScenarios":"Looking up credentials for an access key that has no user record (deleted user, typo'd key, STS-derived key not yet materialized); calling set_user_status / group add / policy detach for a user name absent from the store; deleting group members where one member no longer exists.","commonSituations":"Client keeps using an access key after the user was deleted or disabled-and-removed; console operations referencing a user renamed or recreated; IAM store partially synced after restore-from-backup; scripts hitting the admin API with stale user names.","solutions":["List current users via the admin IAM API and confirm the exact access key/user name spelling","If the user was deleted, recreate it (admin user add) or update the client to use a valid credential","For group operations, remove the stale member reference before retrying the group mutation","If the store was restored, verify config/iam consistency (users vs group membership files)"],"exampleFix":"// before\nlet creds = manager.get_user_credentials(&access_key).await?; // NoSuchUser bubbles\n\n// after\nuse rustfs_iam::error::{is_err_no_such_user, Error};\nlet creds = match manager.get_user_credentials(&access_key).await {\n    Err(e) if is_err_no_such_user(&e) => return Err(AuthError::InvalidAccessKey(access_key)), // map to auth failure\n    r => r?,\n};","handlingStrategy":"type-guard","validationCode":"// Before user-targeted operations, confirm the user exists:\n// if !admin.user_exists(access_key).await? { return Err(handled_invalid_key(access_key)); }","typeGuard":"// The crate ships this guard (crates/iam/src/error.rs):\n// pub fn is_err_no_such_user(err: &Error) -> bool\nif is_err_no_such_user(&e) { /* map to 404/InvalidAccessKey */ }","tryCatchPattern":"match manager.get_user_credentials(access_key).await {\n    Err(e) if is_err_no_such_user(&e) => Err(AuthError::InvalidAccessKey(access_key.to_string())),\n    r => r,\n}","preventionTips":["Invalidate client credentials when deleting users; audit for keys still in use first","Clean group membership and policy attachments before deleting a user","After restoring the IAM store from backup, reconcile users vs groups vs policies"],"tags":["iam","user-management","not-found","rust"],"backgroundTag":"user-not-found","analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}