pinpoint-apm/pinpoint · error · PinpointUserGroupException

There is not userId or fail to create userGroup.

Error message

There is not userId or fail to create userGroup.

What it means

When not running in open-source mode, createUserGroup fetches the current authenticated user's id via userService.getUserIdFromSecurity() to auto-insert the creator as a group member; if the id is empty/blank it throws PinpointUserGroupException because the group would be created without an owner. Note: by then the group row may already be inserted.

Solutions

  1. Ensure the request is authenticated so getUserIdFromSecurity returns a valid id.
  2. Pass through the authenticated web endpoint rather than calling the service internally without a security context.
  3. Catch PinpointUserGroupException and clean up / retry with an explicit creator id.

Example fix

// before
userGroupService.createUserGroup(group); // from unauthenticated batch
// after
UserGroupMember member = new UserGroupMember(group.getId(), authenticatedUserId);
userGroupService.createUserGroup(group);
userGroupService.insertMember(member);
Defensive patterns

Strategy: try-catch

Validate before calling

String userId = userService.getUserIdFromSecurity();
if (StringUtils.isEmpty(userId)) { /* abort or supply explicit creator */ }

Try / catch

try { userGroupService.createUserGroup(group); } catch (PinpointUserGroupException e) { /* no authenticated user — retry authenticated or clean up */ }

Prevention

When it happens

Trigger: Calling createUserGroup with isOpenSource=false while the security context holds no user id — e.g. unauthenticated/internal calls, scheduler-triggered creation, or a security setup where getUserIdFromSecurity returns empty.

Common situations: Non-open-source (enterprise) builds where calls bypass Spring Security authentication; batch/CLI provisioning of user groups without a logged-in user.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/61ef7e184c6e370a. Report an issue: GitHub.

Appendix: source

Thrown at user/src/main/java/com/navercorp/pinpoint/user/service/UserGroupServiceImpl.java:97

        this.userConfigProperties = Objects.requireNonNull(userConfigProperties, "userConfigProperties");
        this.userService = Objects.requireNonNull(userService, "userService");
        this.userGroupDeletionListeners = List.copyOf(
                Objects.requireNonNull(userGroupDeletionListeners, "userGroupDeletionListeners")
        );
    }

    @Override
    public String createUserGroup(UserGroup userGroup) throws PinpointUserGroupException {
        if (userGroupDao.isExistUserGroup(userGroup.getId())) {
            throw new PinpointUserGroupException("userGroup's name already exist. :" + userGroup.getId());
        }

        String userGroupNumber = userGroupDao.createUserGroup(userGroup);

        if (!userConfigProperties.isOpenSource()) {
            String userId = userService.getUserIdFromSecurity();
            if (StringUtils.isEmpty(userId)) {
                throw new PinpointUserGroupException("There is not userId or fail to create userGroup.");
            }

            insertMember(new UserGroupMember(userGroup.getId(), userId));
        }

        return userGroupNumber;
    }

    @Override
    @Transactional(readOnly = true)
    public List<UserGroup> selectUserGroup() {
        return userGroupDao.selectUserGroup();
    }

    @Override
    @Transactional(readOnly = true)
    public List<UserGroup> selectUserGroupByUserId(String userId) {
        return userGroupDao.selectUserGroupByUserId(userId);

View on GitHub (pinned to 744c3d3075)