{"record":{"id":"90b977e222283760","repo":"flowable/flowable-engine","slug":"user-userid-doesn-t-exist","errorCode":null,"errorMessage":"user ${userId} doesn't exist","messagePattern":"user (.+?) doesn't exist","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetUserPictureCmd.java","lineNumber":49,"sourceCode":"    private static final long serialVersionUID = 1L;\n    protected String userId;\n\n    public GetUserPictureCmd(String userId) {\n        this.userId = userId;\n    }\n\n    @Override\n    public Picture execute(CommandContext commandContext) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"userId is null\");\n        }\n\n        User user = CommandContextUtil.getIdmEngineConfiguration().getIdmIdentityService()\n                .createUserQuery().userId(userId)\n                .singleResult();\n\n        if (user == null) {\n            throw new FlowableObjectNotFoundException(\"user \" + userId + \" doesn't exist\", User.class);\n        }\n\n        return CommandContextUtil.getUserEntityManager(commandContext).getUserPicture(user);\n    }\n\n}\n","sourceCodeStart":31,"sourceCodeEnd":56,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetUserPictureCmd.java#L31-L56","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the userId exists first via createUserQuery().userId(id).singleResult() before fetching the picture","Check for typos, casing, or wrong identifier type (id vs email)","Confirm the engine connects to the database containing the user (correct datasource/tenant)","Catch FlowableObjectNotFoundException and render a default/empty picture"],"exampleFix":"// before\nPicture picture = identityService.getUserPicture(userId);\n// after\nUser user = identityService.createUserQuery().userId(userId).singleResult();\nPicture picture = user != null ? identityService.getUserPicture(userId) : null;","handlingStrategy":"try-catch","validationCode":"User user = identityService.createUserQuery().userId(userId).singleResult();\nif (user == null) { /* handle missing user before fetching picture */ }","typeGuard":"boolean userExists(String userId) { return userId != null && identityService.createUserQuery().userId(userId).count() > 0; }","tryCatchPattern":"try { Picture p = identityService.getUserPicture(userId); } catch (FlowableObjectNotFoundException e) { picture = defaultAvatar(); }","preventionTips":["Check user existence before dependent operations","Avoid keeping stale userIds across user-deletion jobs","Verify datasource/tenant when users live in a separate DB"],"tags":["flowable","idm","not-found","user"],"backgroundTag":"user-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}