flowable/flowable-engine · error · FlowableIllegalArgumentException
userId is null
Error message
userId is null
What it means
SetUserPictureCmd stores a Picture for a user identified by userId. The userId is the lookup key for the target user, so a null value is rejected up front with FlowableIllegalArgumentException before querying the identity service.
Source
Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/SetUserPictureCmd.java:43
/**
* @author Tom Baeyens
*/
public class SetUserPictureCmd implements Command<Object>, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
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)
Solutions
- Set the userId variable/parameter before invoking the behavior or service call
- Guard the call: only setUserPicture when userId != null
- Ensure the calling ActivityBehavior initializes its fields in the setter/constructor
Example fix
// before
identityService.setUserPicture(userId, picture);
// after
if (userId != null) {
identityService.setUserPicture(userId, picture);
} Defensive patterns
Strategy: validation
Validate before calling
if (userId == null || userId.isEmpty()) throw new IllegalArgumentException("userId is required to set a picture"); Type guard
boolean canSetPicture(String userId, Picture p) { return userId != null && !userId.trim().isEmpty() && p != null; } Try / catch
try { identityService.setUserPicture(userId, picture); } catch (FlowableIllegalArgumentException e) { log.warn("Cannot set picture: missing userId"); } Prevention
- Ensure ActivityBehavior userId fields are set before execute runs
- Set the userId process variable before delegating to picture logic
- Null-check variables pulled from execution context
When it happens
Trigger: Calling identityService.setUserPicture(null, picture) or executing new SetUserPictureCmd(null, picture); also reached from executeActivityBehavior when the userId process variable is unset.
Common situations: Delegates/behavior classes reading a userId variable that was never set on the execution; image-upload endpoints that drop the user id parameter.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/bfebb486935ccf32.
Report an issue: GitHub.