flowable/flowable-engine · error · FlowableObjectNotFoundException
User '' is not part of group ''.
Error message
User '' is not part of group ''.
What it means
GroupMembershipResource.deleteMembership verifies the user is actually a member of the group via createUserQuery().memberOfGroup(groupId).userId(userId).count() before deleting. When the count is not 1, it throws FlowableObjectNotFoundException (HTTP 404) because the membership does not exist, even though both user and group may individually exist.
Solutions
- Verify the membership exists before deleting: GET /identity/groups/{groupId}/members and check the userId.
- Treat 404 from this endpoint as 'already removed' and continue in cleanup scripts.
- Confirm the exact groupId/userId spelling and casing.
Example fix
// before
client.delete("/identity/groups/sales/members/" + userId); // 404 if not a member
// after
if (fetchMemberIds("sales").contains(userId)) {
client.delete("/identity/groups/sales/members/" + userId);
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean isMember = client.list("/identity/groups/" + groupId + "/members").stream()
.anyMatch(m -> userId.equals(m.getUserId())); Try / catch
try {
client.delete("/identity/groups/" + groupId + "/members/" + userId);
} catch (HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.NOT_FOUND) {
log.info("Membership {}#{} already absent", groupId, userId);
} else throw e;
} Prevention
- Check membership before removal in cleanup scripts.
- Treat 404 as idempotent success on deletes.
- Verify groupId/userId spelling and casing.
When it happens
Trigger: DELETE /identity/groups/{groupId}/members/{userId} where the user is not a member of the group (or the group does not exist, since getGroupFromRequest runs first).
Common situations: De-provisioning scripts removing memberships that were never created; user already removed by a concurrent request; wrong groupId/userId pairing (member of another group); case-sensitivity mismatch in the user id.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Could not find a batch with id
- Could not find a job with id ''.
- ${aonfe.getMessage()}
- Batch part with id ' ' does not have a batch part document.
- Batch with id ' ' does not have a batch document.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d380db9acf9e39c6.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/GroupMembershipResource.java:51
*/
@RestController
@Api(tags = { "Groups" }, authorizations = { @Authorization(value = "basicAuth") })
public class GroupMembershipResource extends BaseGroupResource {
@ApiOperation(value = "Delete a member from a group", tags = { "Groups" }, code = 204)
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."),
@ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.")
})
@DeleteMapping("/identity/groups/{groupId}/members/{userId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId) {
Group group = getGroupFromRequest(groupId);
// Check if user is not a member of group since API does not return typed exception
if (identityService.createUserQuery().memberOfGroup(group.getId()).userId(userId).count() != 1) {
throw new FlowableObjectNotFoundException("User '" + userId + "' is not part of group '" + group.getId() + "'.", null);
}
identityService.deleteMembership(userId, group.getId());
}
}
View on GitHub (pinned to d6d39ce1c6)