{"record":{"id":"41a474c6a6664d75","repo":"flowable/flowable-engine","slug":"provided-first-name-is-null","errorCode":null,"errorMessage":"Provided first name is null","messagePattern":"Provided first 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":96,"sourceCode":"            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\");\n        }\n        this.idIgnoreCase = id.toLowerCase();\n        return this;\n    }\n\n    @Override\n    public UserQuery userFirstName(String firstName) {\n        if (firstName == null) {\n            throw new FlowableIllegalArgumentException(\"Provided first name is null\");\n        }\n        this.firstName = firstName;\n        return this;\n    }\n\n    @Override\n    public UserQuery userFirstNameLike(String firstNameLike) {\n        if (firstNameLike == null) {\n            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\");","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java#L78-L114","documentation":"UserQueryImpl.userFirstName(String) filters users by exact first name. Passing null throws FlowableIllegalArgumentException because null is not a valid equality criterion for the generated query. The library fails fast when the criterion is added, before hitting the database.","triggerScenarios":"Calling UserQuery.userFirstName(null), commonly in a dynamic user search where the first-name filter field was empty and mapped to null.","commonSituations":"Search forms with optional name fields; REST query parameters absent from the request; code applying every criterion unconditionally instead of skipping unset ones.","solutions":["Pass a non-null first name value.","Add the criterion only when the search field is non-null/empty.","Treat empty strings deliberately: convert empty form fields to null at the boundary and then skip the criterion."],"exampleFix":"// before\nUserQuery q = identityService.createUserQuery().userFirstName(search.getFirstName());\n\n// after\nUserQuery q = identityService.createUserQuery();\nif (search.getFirstName() != null && !search.getFirstName().isEmpty()) {\n    q = q.userFirstName(search.getFirstName());\n}","handlingStrategy":"validation","validationCode":"if (firstName != null && !firstName.isEmpty()) {\n    query = query.userFirstName(firstName);\n}","typeGuard":"boolean hasSearchValue(String v) { return v != null && !v.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.userFirstName(firstName);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"first name is null\")) { /* skip criterion */ } else { throw e; }\n}","preventionTips":["Build search queries conditionally from optional filter fields.","Convert empty form inputs to null at the controller layer, then skip such criteria.","Use a central query-assembly helper for all UserQuery criteria."],"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"}