{"record":{"id":"feae7348109644a2","repo":"flowable/flowable-engine","slug":"provided-id-is-null-feae73","errorCode":null,"errorMessage":"Provided id is null","messagePattern":"Provided id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java","lineNumber":69,"sourceCode":"    protected String groupId;\n    protected List<String> groupIds;\n    protected String tenantId;\n\n    public UserQueryImpl() {\n    }\n\n    public UserQueryImpl(CommandContext commandContext) {\n        super(commandContext);\n    }\n\n    public UserQueryImpl(CommandExecutor commandExecutor) {\n        super(commandExecutor);\n    }\n\n    @Override\n    public UserQuery userId(String id) {\n        if (id == null) {\n            throw new FlowableIllegalArgumentException(\"Provided id is null\");\n        }\n        this.id = id;\n        return this;\n    }\n\n    @Override\n    public UserQuery userIds(List<String> ids) {\n        if (ids == null) {\n            throw new FlowableIllegalArgumentException(\"Provided ids is null\");\n        }\n        this.ids = ids;\n        return this;\n    }\n\n    @Override\n    public UserQuery userIdIgnoreCase(String id) {\n        if (id == null) {\n            throw new FlowableIllegalArgumentException(\"Provided id is null\");","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java#L51-L87","documentation":"UserQueryImpl.userId(String) filters IDM users by exact id. Passing null throws FlowableIllegalArgumentException because null is not a usable equality criterion and would silently alter query semantics. Validation is done eagerly when the criterion is added.","triggerScenarios":"Calling UserQuery.userId(null), typically identityService.createUserQuery().userId(id) where the id variable is null (unknown user, unauthenticated principal, unset request path variable).","commonSituations":"Looking up a user by an id taken from a URL/JWT claim that is absent; referencing a deleted user id that resolves to null in an earlier step; unit tests passing null accidentally.","solutions":["Check that the id is non-null (and non-empty) before building the query.","Handle the 'id not provided' case explicitly at the application layer (401/400) instead of querying with null.","If you need existence checking, first guard the id source that produced null."],"exampleFix":"// before\nUser user = identityService.createUserQuery().userId(pathId).singleResult();\n\n// after\nif (pathId == null || pathId.isEmpty()) {\n    throw new IllegalArgumentException(\"User id path variable is required\");\n}\nUser user = identityService.createUserQuery().userId(pathId).singleResult();","handlingStrategy":"validation","validationCode":"if (id == null || id.isEmpty()) {\n    throw new IllegalArgumentException(\"User id is required\");\n}\nidentityService.createUserQuery().userId(id);","typeGuard":"boolean hasUserId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try {\n    user = identityService.createUserQuery().userId(id).singleResult();\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Missing user id for user lookup\", e);\n}","preventionTips":["Validate path variables and JWT subject claims before querying users.","Distinguish 'not provided' (400) from 'not found' (404) at the application layer.","Use a shared lookup service that null-checks ids once."],"tags":["null-check","query-builder","idm-engine","java"],"backgroundTag":"null-argument","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"}