flowable/flowable-engine · error · FlowableConflictException

A user with id '' already exists.

Error message

A user with id '' already exists.

What it means

Uniqueness violation in UserCollectionResource.createUser: a user with the requested id already exists in the identity store, so creation is refused (typically surfaced as a 409-style REST error). The existing user must be updated instead.

Solutions

  1. Use PUT /identity/users/{userId} to update the existing user
  2. Choose a unique user id
  3. Check existence via GET /identity/users/{userId} before creating
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserCollectionResource.java:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/8b91dccce5ef2857. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserCollectionResource.java:161

    @ApiResponses(value = {
            @ApiResponse(code = 201, message = "Indicates the user was created."),
            @ApiResponse(code = 400, message = "Indicates the id of the user was missing.")

    })
    @PostMapping(value = "/identity/users", produces = "application/json")
    @ResponseStatus(HttpStatus.CREATED)
    public UserResponse createUser(@RequestBody UserRequest userRequest) {
        if (userRequest.getId() == null) {
            throw new FlowableIllegalArgumentException("Id cannot be null.");
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.createUser(userRequest);
        }

        // Check if a user with the given ID already exists so we return a CONFLICT
        if (identityService.createUserQuery().userId(userRequest.getId()).count() > 0) {
            throw new FlowableConflictException("A user with id '" + userRequest.getId() + "' already exists.");
        }

        User created = identityService.newUser(userRequest.getId());
        created.setEmail(userRequest.getEmail());
        created.setFirstName(userRequest.getFirstName());
        created.setLastName(userRequest.getLastName());
        created.setDisplayName(userRequest.getDisplayName());
        created.setPassword(userRequest.getPassword());
        created.setTenantId(userRequest.getTenantId());
        identityService.saveUser(created);

        return restResponseFactory.createUserResponse(created, true);
    }

}

View on GitHub (pinned to d6d39ce1c6)