pinpoint-apm/pinpoint · error · ResponseStatusException

there is not userId in params to delete user

Error message

there is not userId in params to delete user

What it means

UserController's DELETE /user requires a User body whose userId is non-empty; when StringUtils.isEmpty(user.getUserId()) it throws a 400 ResponseStatusException and no deletion happens. This guards against deleting based on an unspecified user.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/UserController.java:77

    @PreAuthorize("hasPermission(null, null, T(com.navercorp.pinpoint.web.security.PermissionChecker).PERMISSION_ADMINISTRATION_EDIT_USER)")
    @PostMapping
    public Response insertUser(@RequestBody User user) {
        if (!ValueValidator.validateUser(user)) {
            throw new ResponseStatusException(
                    HttpStatus.BAD_REQUEST,
                    "User information validation failed to creating user information."
            );
        }
        userService.insertUser(user);
        return SimpleResponse.ok();
    }

    @PreAuthorize("hasPermission(null, null, T(com.navercorp.pinpoint.web.security.PermissionChecker).PERMISSION_ADMINISTRATION_EDIT_USER)")
    @DeleteMapping
    public Response deleteUser(@RequestBody User user) {
        if (StringUtils.isEmpty(user.getUserId())) {
            throw new ResponseStatusException(
                    HttpStatus.BAD_REQUEST,
                    "there is not userId in params to delete user"
            );
        }
        userService.deleteUser(user.getUserId());
        return SimpleResponse.ok();
    }

    @GetMapping(params = "userId")
    public List<User> getUserByUserId(@RequestParam("userId") @NotBlank String userId) {
        try {
            final User user = userService.selectUserByUserId(userId);
            return List.of(user);
        } catch (Exception e) {
            logger.error("Cannot select user", e);
            throw new ResponseStatusException(
                    HttpStatus.INTERNAL_SERVER_ERROR,
                    "This api need to collect condition for search."

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Include the target userId in the JSON request body: {"userId":"someuser"}
  2. Verify the client actually reads the user's id before issuing the delete (no stale/blank selection)
  3. If deleting by name or other attribute, resolve the userId first via GET /user
  4. Confirm Content-Type is application/json so the body deserializes into User

Example fix

// before
axios.delete('/user', {})
// after
axios.delete('/user', { data: { userId: 'alice' } })
Defensive patterns

Strategy: validation

Validate before calling

// Ensure userId present before DELETE /user
if (!user || !user.userId) {
  throw new Error('deleteUser requires a non-empty userId');
}

Type guard

function hasUserId(u) {
  return typeof u === 'object' && u !== null && typeof u.userId === 'string' && u.userId.length > 0;
}

Try / catch

try {
  await axios.delete('/user', { data: { userId } });
} catch (e) {
  if (e.response && e.response.status === 400) {
    console.error('userId missing in delete request body');
  }
  throw e;
}

Prevention

When it happens

Trigger: DELETE /user with an empty JSON body, a body lacking the userId field, or a body where userId is null/blank.

Common situations: Scripts calling DELETE with an empty object {}; assuming userId is passed as a query parameter instead of in the JSON body; UI sending the whole user object after the field was renamed.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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