UserNotFoundException
aws
auth_error
ai_generated
true
An error occurred (UserNotFoundException) when calling the AdminGetUser operation: User not found
ID: aws/cognito-user-not-found-exception
90%Fix Rate
88%Confidence
1Evidence
2023-05-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Cognito User Pools API 2016-04-18 | active | — | — | — |
| AWS SDK for JavaScript 3.600.0 | active | — | — | — |
Root Cause
The specified user does not exist in the Amazon Cognito user pool, possibly due to incorrect username, user deletion, or using a user pool ID from a different environment.
generic中文
指定的用户在 Amazon Cognito 用户池中不存在,可能是因为用户名错误、用户已删除或使用了不同环境的用户池 ID。
Official Documentation
https://docs.aws.amazon.com/cognito/latest/developerguide/error-messages.htmlWorkarounds
-
95% success Verify the username exists by listing users in the pool: `aws cognito-idp list-users --user-pool-id <pool-id> --query "Users[?Username=='<username>']"`. If missing, re-create the user with `aws cognito-idp admin-create-user --user-pool-id <pool-id> --username <username>`.
Verify the username exists by listing users in the pool: `aws cognito-idp list-users --user-pool-id <pool-id> --query "Users[?Username=='<username>']"`. If missing, re-create the user with `aws cognito-idp admin-create-user --user-pool-id <pool-id> --username <username>`.
-
85% success Check that the user pool ID in the request matches the correct environment (dev vs prod) and that the user was not accidentally deleted via AWS Console or API.
Check that the user pool ID in the request matches the correct environment (dev vs prod) and that the user was not accidentally deleted via AWS Console or API.
中文步骤
Verify the username exists by listing users in the pool: `aws cognito-idp list-users --user-pool-id <pool-id> --query "Users[?Username=='<username>']"`. If missing, re-create the user with `aws cognito-idp admin-create-user --user-pool-id <pool-id> --username <username>`.
Check that the user pool ID in the request matches the correct environment (dev vs prod) and that the user was not accidentally deleted via AWS Console or API.
Dead Ends
Common approaches that don't work:
-
Re-running the same AdminGetUser call with the same credentials, expecting a different result.
100% fail
The user truly does not exist; retrying does not create or recover the user.
-
Modifying IAM permissions to allow all cognito-idp actions, assuming it's a permission issue.
80% fail
The error is UserNotFoundException, not AccessDenied; permissions are sufficient.