flowable/flowable-engine · error · FlowableObjectNotFoundException

user doesn't exist

Error message

user ${userId} doesn't exist

What it means

GetUserPictureCmd queries the identity service for the user with the given userId. When the query returns no user, the command throws FlowableObjectNotFoundException including the userId and the expected User type, because a picture can only be read from an existing user entity.

Solutions

  1. Verify the userId exists first via createUserQuery().userId(id).singleResult() before fetching the picture
  2. Check for typos, casing, or wrong identifier type (id vs email)
  3. Confirm the engine connects to the database containing the user (correct datasource/tenant)
  4. Catch FlowableObjectNotFoundException and render a default/empty picture

Example fix

// before
Picture picture = identityService.getUserPicture(userId);
// after
User user = identityService.createUserQuery().userId(userId).singleResult();
Picture picture = user != null ? identityService.getUserPicture(userId) : null;
Defensive patterns

Strategy: try-catch

Validate before calling

User user = identityService.createUserQuery().userId(userId).singleResult();
if (user == null) { /* handle missing user before fetching picture */ }

Type guard

boolean userExists(String userId) { return userId != null && identityService.createUserQuery().userId(userId).count() > 0; }

Try / catch

try { Picture p = identityService.getUserPicture(userId); } catch (FlowableObjectNotFoundException e) { picture = defaultAvatar(); }

Prevention

When it happens

Trigger: Calling identityService.getUserPicture(userId) where no User row exists for that id — e.g. the user was deleted, the id is misspelled/wrong-case, or the query runs against the wrong tenant/database.

Common situations: Reading pictures of users that were removed from the IDM tables; using an email instead of the user id; stale references after database migration or multi-datasource misconfiguration.

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/90b977e222283760. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetUserPictureCmd.java:49

    private static final long serialVersionUID = 1L;
    protected String userId;

    public GetUserPictureCmd(String userId) {
        this.userId = userId;
    }

    @Override
    public Picture 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);
        }

        return CommandContextUtil.getUserEntityManager(commandContext).getUserPicture(user);
    }

}

View on GitHub (pinned to d6d39ce1c6)