pinpoint-apm/pinpoint · error · UsernameNotFoundException

User not found:

Error message

User not found: 

What it means

PinpointMemoryUserDetailsService.loadUserByUsername looks up users in an in-memory map and throws Spring Security's UsernameNotFoundException ('User not found: <username>') when absent. This is the standard Spring Security contract for unknown users.

Source

Thrown at basic-login/src/main/java/com/navercorp/pinpoint/login/basic/service/PinpointMemoryUserDetailsService.java:75

        List<UserDetails> adminList = basicLoginConfig.getAdminList();
        for (UserDetails admin : adminList) {
            userDetailsMap.put(admin.getUsername(), admin);
        }

        if (logger.isDebugEnabled()) {
            Collection<String> adminRoleUserNameList = adminList.stream().map(UserDetails::getUsername).collect(Collectors.toList());
            logger.debug("Has been registered {} that has ADMIN role.", adminRoleUserNameList);
        }

        this.userDetailsMap = Map.copyOf(userDetailsMap);
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        UserDetails userDetails = userDetailsMap.get(username);
        if (userDetails == null) {
            throw new UsernameNotFoundException("User not found: " + username);
        }

        return new User(
                userDetails.getUsername(),
                userDetails.getPassword(),
                userDetails.isEnabled(),
                userDetails.isAccountNonExpired(),
                userDetails.isCredentialsNonExpired(),
                userDetails.isAccountNonLocked(),
                userDetails.getAuthorities()
        );
    }

}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Register the user through Pinpoint user management so it lands in the in-memory map
  2. Check the user list configuration/resource is loaded at startup (non-empty userDetailsMap)
  3. Treat UsernameNotFoundException as 'bad credentials' in the auth flow and prompt re-login
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = userService.isUserExist(userId);
if (!exists) { throw new UsernameNotFoundException(userId); }

Try / catch

try { UserDetails d = svc.loadUserByUsername(username); } catch (UsernameNotFoundException e) { throw new BadCredentialsException("bad credentials"); }

Prevention

When it happens

Trigger: Any authentication or cookie-creation flow calling loadUserByUsername with a username not present in userDetailsMap.

Common situations: Typo in username at login; in-memory user repository not loaded (missing/empty user file); user deleted while a valid JWT cookie still references them.

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 pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/5ab44e09375e8752. Report an issue: GitHub.