flowable/flowable-engine · error · FlowableObjectNotFoundException
user doesn't exist
Error message
user ${userId} doesn't exist What it means
SetUserPictureCmd queries the identity service for the user with the given userId and then delegates to UserEntityManager.setUserPicture. When no such user exists, the command throws FlowableObjectNotFoundException naming the userId and the expected User type, since a picture can only be set on an existing user.
Solutions
- Verify the user exists via createUserQuery().userId(id).singleResult() before setting the picture
- Fix the identifier (spelling/case/type) or re-create the missing user
- Confirm the engine uses the correct datasource/tenant
- Catch FlowableObjectNotFoundException and skip or queue the picture update
Example fix
// before
identityService.setUserPicture(userId, picture);
// after
User user = identityService.createUserQuery().userId(userId).singleResult();
if (user != null) {
identityService.setUserPicture(userId, picture);
} Defensive patterns
Strategy: try-catch
Validate before calling
User user = identityService.createUserQuery().userId(userId).singleResult();
if (user == null) { /* user missing; abort or recreate before setting picture */ } Type guard
boolean canSetUserPicture(String userId) { return userId != null && identityService.createUserQuery().userId(userId).count() > 0; } Try / catch
try { identityService.setUserPicture(userId, picture); } catch (FlowableObjectNotFoundException e) { log.warn("User " + userId + " gone; skipping picture", e); } Prevention
- Verify the user exists before mutating dependent data
- Keep identity sync jobs from deleting users referenced elsewhere
- Confirm the correct datasource/tenant before writes
When it happens
Trigger: Calling identityService.setUserPicture(userId, picture) where the user row does not exist — deleted user, misspelled id, or wrong datasource/tenant; also reached from executeActivityBehavior with a stale userId variable.
Common situations: Setting pictures for users removed by an identity sync job; id vs email mix-ups; running against a fresh/different database than the one holding users.
Understand the failure class
Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e9e8249ccea6ef10.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/SetUserPictureCmd.java:51
protected Picture picture;
public SetUserPictureCmd(String userId, Picture picture) {
this.userId = userId;
this.picture = picture;
}
@Override
public Object execute(CommandContext commandContext) {
if (userId == null) {
throw new FlowableIllegalArgumentException("userId is null");
}
User user = CommandContextUtil.getIdmEngineConfiguration().getIdmIdentityService()
.createUserQuery().userId(userId)
.singleResult();
if (user == null) {
throw new FlowableObjectNotFoundException("user " + userId + " doesn't exist", User.class);
}
CommandContextUtil.getUserEntityManager(commandContext).setUserPicture(user, picture);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)