{"record":{"id":"f54789dd58e480c8","repo":"flowable/flowable-engine","slug":"provided-last-name-is-null","errorCode":null,"errorMessage":"Provided last name is null","messagePattern":"Provided last name 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":123,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided first name is null\");\n        }\n        this.firstNameLike = firstNameLike;\n        return this;\n    }\n\n    @Override\n    public UserQuery userFirstNameLikeIgnoreCase(String firstNameLikeIgnoreCase) {\n        if (firstNameLikeIgnoreCase == null) {\n            throw new FlowableIllegalArgumentException(\"Provided first name is null\");\n        }\n        this.firstNameLikeIgnoreCase = firstNameLikeIgnoreCase.toLowerCase();\n        return this;\n    }\n\n    @Override\n    public UserQuery userLastName(String lastName) {\n        if (lastName == null) {\n            throw new FlowableIllegalArgumentException(\"Provided last name is null\");\n        }\n        this.lastName = lastName;\n        return this;\n    }\n\n    @Override\n    public UserQuery userLastNameLike(String lastNameLike) {\n        if (lastNameLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided last name is null\");\n        }\n        this.lastNameLike = lastNameLike;\n        return this;\n    }\n\n    @Override\n    public UserQuery userLastNameLikeIgnoreCase(String lastNameLikeIgnoreCase) {\n        if (lastNameLikeIgnoreCase == null) {\n            throw new FlowableIllegalArgumentException(\"Provided last name is null\");","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java#L105-L141","documentation":"FlowableIllegalArgumentException thrown by UserQueryImpl.userLastName when the lastName argument is null. The engine validates criteria eagerly at query-construction time; a null last name is not a valid equality filter, so it is rejected with a clear message instead of producing invalid SQL. Supply a concrete last-name string.","triggerScenarios":"Calling identityService.createUserQuery().userLastName(null), or chaining userLastName(value) where value came from a nullable variable, request parameter, or user profile field that was null.","commonSituations":"User lookup forms with empty surname field; code that assumes a profile field exists but it was never populated; copying values from external systems (SSO/LDAP sync) where last name is optional.","solutions":["Pass a concrete non-null last name: userLastName(\"Smith\")","Apply the criterion conditionally: if (lastName != null) query.userLastName(lastName)","Use userLastNameLike(\"%\") if you need a wildcard 'any last name' filter rather than null","Sanitize/validate the source field (request param, DTO, profile attribute) before building the query"],"exampleFix":"// before\nUser user = identityService.createUserQuery().userLastName(req.getParameter(\"lastName\")).singleResult();\n\n// after\nString lastName = req.getParameter(\"lastName\");\nUserQuery query = identityService.createUserQuery();\nif (lastName != null) {\n    query = query.userLastName(lastName);\n}\nUser user = query.singleResult();","handlingStrategy":"validation","validationCode":"if (lastName == null) { throw new IllegalArgumentException(\"lastName is required\"); }\nidentityService.createUserQuery().userLastName(lastName);","typeGuard":"boolean isPresent(String v) { return v != null && !v.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.userLastName(lastName);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Missing last-name criterion: {}\", e.getMessage());\n}","preventionTips":["Validate surname input at the entry point (controller/service) before querying","Use conditional chaining for optional criteria","Remember the engine rejects null, not empty strings — still avoid empty filters","Cover nullable profile fields (e.g. from LDAP/SSO sync) with explicit defaults"],"tags":["flowable","idm-engine","user-query","null-argument","validation"],"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"}