UserNotFoundException aws auth_error ai_generated true

发生错误 (UserNotFoundException):调用 AdminGetUser 操作时:未找到用户

An error occurred (UserNotFoundException) when calling the AdminGetUser operation: User not found

ID: aws/cognito-user-not-found-exception

其他格式: JSON · Markdown 中文 · English
90%修复率
88%置信度
1证据数
2023-05-20首次发现

版本兼容性

版本状态引入弃用备注
Cognito User Pools API 2016-04-18 active
AWS SDK for JavaScript 3.600.0 active

根因分析

指定的用户在 Amazon Cognito 用户池中不存在,可能是因为用户名错误、用户已删除或使用了不同环境的用户池 ID。

English

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

官方文档

https://docs.aws.amazon.com/cognito/latest/developerguide/error-messages.html

解决方案

  1. 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>`.
  2. 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.

无效尝试

常见但无效的做法:

  1. Re-running the same AdminGetUser call with the same credentials, expecting a different result. 100% 失败

    The user truly does not exist; retrying does not create or recover the user.

  2. Modifying IAM permissions to allow all cognito-idp actions, assuming it's a permission issue. 80% 失败

    The error is UserNotFoundException, not AccessDenied; permissions are sufficient.