{"record":{"id":"3fe4e684da6581d0","repo":"pinpoint-apm/pinpoint","slug":"could-not-load-user-information","errorCode":null,"errorMessage":"Could not load User information.","messagePattern":"Could not load User information\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"basic-login/src/main/java/com/navercorp/pinpoint/login/basic/service/BasicLoginService.java","lineNumber":99,"sourceCode":"                        logger.warn(\"This token already expired.\");\n                    }\n                } catch (ExpiredJwtException e) {\n                    logger.warn(\"This token already expired. message:{}\", e.getMessage(), e);\n                } catch (JwtException e) {\n                    logger.warn(\"Invalid JWT token. message:{}\", e.getMessage());\n                } catch (UsernameNotFoundException e) {\n                    logger.warn(\"Could not find user for JWT token. message:{}\", e.getMessage());\n                }\n            }\n        }\n\n        return null;\n    }\n\n    public Cookie createNewCookie(String userId) {\n        UserDetails userDetails = pinpointMemoryUserDetailsService.loadUserByUsername(userId);\n        if (userDetails == null) {\n            throw new IllegalArgumentException(\"Could not load User information.\");\n        }\n\n        String token = jwtService.createToken(userDetails);\n        Cookie cookie = new Cookie(BasicLoginConstants.PINPOINT_JWT_COOKIE_NAME, token);\n        cookie.setPath(\"/\");\n        cookie.setHttpOnly(jwtCookieHttpOnly);\n        cookie.setSecure(jwtCookieSecure);\n        if (jwtCookieSameSite != null && !jwtCookieSameSite.isBlank()) {\n            cookie.setAttribute(\"SameSite\", jwtCookieSameSite);\n        }\n\n        long maxAge = TimeUnit.MILLISECONDS.toSeconds(jwtService.getExpirationTimeMillis());\n        cookie.setMaxAge((int) maxAge);\n        return cookie;\n    }\n\n    public UserDetailsService getUserDetailsService() {\n        return pinpointMemoryUserDetailsService;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/basic-login/src/main/java/com/navercorp/pinpoint/login/basic/service/BasicLoginService.java#L81-L117","documentation":"BasicLoginService.createNewCookie creates a JWT cookie for a user and throws IllegalArgumentException with 'Could not load User information.' when pinpointMemoryUserDetailsService.loadUserByUsername returns null. This guards against issuing a token for a user the service cannot resolve.","triggerScenarios":"createNewCookie(userId) called (directly or via cookie()/getUserDetailsShouldIgnoreJwtForUnknownUser()) with a userId absent from the in-memory user details map, when loadUserByUsername returns null instead of throwing.","commonSituations":"Cookie presented for a user deleted or renamed in user management; login against an in-memory user store that was never populated with that userId; stale cookies after user data reset.","solutions":["Ensure the userId exists in the user store (re-register the user via user management)","Check that userDetailsMap is populated at startup (user list file/config loaded correctly)","Handle the IllegalArgumentException upstream and clear the stale auth cookie"],"exampleFix":"// before\nCookie c = basicLoginService.createNewCookie(userId); // throws if unknown\n// after\nUserDetails d = service.findUser(userId);\nif (d == null) { return null; } // or redirect to login\nCookie c = basicLoginService.createNewCookie(userId);","handlingStrategy":"try-catch","validationCode":"if (basicLoginService.findUser(userId) == null) { return null; // skip cookie creation }","typeGuard":null,"tryCatchPattern":"try { return createNewCookie(userId); } catch (IllegalArgumentException e) { log.warn(\"cannot create cookie, unknown user\"); return null; }","preventionTips":["Validate the userId exists before issuing auth cookies","Purge stale JWT cookies when users are removed","Ensure the in-memory user store is loaded before accepting logins"],"tags":["java","authentication","user"],"backgroundTag":"user-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}