iflytek/astron-agent · error · IllegalArgumentException

Current user does not exist

Error message

Current user does not exist

What it means

updateCurrentUserBasicInfo reads the UID from the request context (RequestContextUtil.getUID) and looks up the user; if no UserInfo row exists for that UID it throws IllegalArgumentException. This means the authenticated identity in the request context does not correspond to a persisted user record.

Solutions

  1. Verify a user_info row exists for the UID returned by RequestContextUtil.getUID()
  2. Check the auth/SSO configuration so the token subject maps to the correct local UID
  3. Clear stale sessions/tokens after user deletion so revoked identities cannot call this API
  4. Catch the IllegalArgumentException in the controller and return 401/404 prompting re-login

Example fix

// before
String uid = RequestContextUtil.getUID();
service.updateCurrentUserBasicInfo(nickname, avatar);
// after
String uid = RequestContextUtil.getUID();
if (userInfoDataService.findByUid(uid).isEmpty()) {
    throw new BusinessException(ResponseEnum.DATA_NOT_FOUND, "please re-login");
}
service.updateCurrentUserBasicInfo(nickname, avatar);
Defensive patterns

Strategy: try-catch

Validate before calling

boolean currentUserExists = userInfoDataService.findByUid(RequestContextUtil.getUID()).isPresent();

Try / catch

try { service.updateCurrentUserBasicInfo(nickname, avatar); } catch (IllegalArgumentException e) { return unauthorized("Please re-login"); }

Prevention

When it happens

Trigger: Calling updateCurrentUserBasicInfo when the authenticated user's row was deleted (or never synced) after login; RequestContextUtil.getUID() returning an identifier absent from the user_info table.

Common situations: Stale sessions/tokens after a user was removed from the DB; environments where the auth token's subject differs from the local user table (e.g. misconfigured SSO or multi-tenant UID mismatch); data restored from backups without users.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/1256a6f06d6bb2ea. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/commons/src/main/java/com/iflytek/astron/console/commons/data/impl/UserInfoDataServiceImpl.java:413

        userInfoMapper.updateById(userInfo);

        // If the nickname has changed, publish an event
        if (StringUtils.isNotBlank(nickname) && !nickname.equals(oldNickname)) {
            eventPublisher.publishEvent(new UserNicknameUpdatedEvent(this, uid, oldNickname, nickname));
            log.info("Published nickname update event for uid: {}, oldNickname: {}, newNickname: {}",
                    uid, oldNickname, nickname);
        }

        return userInfo;
    }

    @Override
    public UserInfo updateCurrentUserBasicInfo(String nickname, String avatar) {
        String currentUid = RequestContextUtil.getUID();
        Optional<UserInfo> userInfoOpt = findByUid(currentUid);

        if (userInfoOpt.isEmpty()) {
            throw new IllegalArgumentException("Current user does not exist");
        }

        UserInfo userInfo = userInfoOpt.get();
        String oldNickname = userInfo.getNickname();

        if (StringUtils.isNotBlank(nickname)) {
            userInfo.setNickname(nickname);
        }
        if (StringUtils.isNotBlank(avatar)) {
            userInfo.setAvatar(avatar);
        }
        userInfo.setUpdateTime(LocalDateTime.now());
        userInfoMapper.updateById(userInfo);

        // If the nickname has changed, publish an event
        if (StringUtils.isNotBlank(nickname) && !nickname.equals(oldNickname)) {
            eventPublisher.publishEvent(new UserNicknameUpdatedEvent(this, currentUid, oldNickname, nickname));
            log.info("Published nickname update event for uid: {}, oldNickname: {}, newNickname: {}",

View on GitHub (pinned to 5e758547a8)