{"record":{"id":"e9e8249ccea6ef10","repo":"flowable/flowable-engine","slug":"user-userid-doesn-t-exist-e9e824","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/SetUserPictureCmd.java","lineNumber":51,"sourceCode":"    protected Picture picture;\n\n    public SetUserPictureCmd(String userId, Picture picture) {\n        this.userId = userId;\n        this.picture = picture;\n    }\n\n    @Override\n    public Object 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        CommandContextUtil.getUserEntityManager(commandContext).setUserPicture(user, picture);\n        return null;\n    }\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":59,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/SetUserPictureCmd.java#L33-L59","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nidentityService.setUserPicture(userId, picture);\n// after\nUser user = identityService.createUserQuery().userId(userId).singleResult();\nif (user != null) {\n    identityService.setUserPicture(userId, picture);\n}","handlingStrategy":"try-catch","validationCode":"User user = identityService.createUserQuery().userId(userId).singleResult();\nif (user == null) { /* user missing; abort or recreate before setting picture */ }","typeGuard":"boolean canSetUserPicture(String userId) { return userId != null && identityService.createUserQuery().userId(userId).count() > 0; }","tryCatchPattern":"try { identityService.setUserPicture(userId, picture); } catch (FlowableObjectNotFoundException e) { log.warn(\"User \" + userId + \" gone; skipping picture\", e); }","preventionTips":["Verify the user exists before mutating dependent data","Keep identity sync jobs from deleting users referenced elsewhere","Confirm the correct datasource/tenant before writes"],"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"}