{"record":{"id":"74db6f5241457acb","repo":"flowable/flowable-engine","slug":"provided-useridlike-is-null","errorCode":null,"errorMessage":"Provided userIdLike is null","messagePattern":"Provided userIdLike is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java","lineNumber":164,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided userAgentLike is null\");\n        }\n        this.userAgentLike = userAgentLike;\n        return this;\n    }\n\n    @Override\n    public TokenQuery userId(String userId) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided user id is null\");\n        }\n        this.userId = userId;\n        return this;\n    }\n\n    @Override\n    public TokenQuery userIdLike(String userIdLike) {\n        if (userIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided userIdLike is null\");\n        }\n        this.userIdLike = userIdLike;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenData(String tokenData) {\n        if (tokenData == null) {\n            throw new FlowableIllegalArgumentException(\"Provided token data is null\");\n        }\n        this.tokenData = tokenData;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDataLike(String tokenDataLike) {\n        if (tokenDataLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tokenDataLike is null\");","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java#L146-L182","documentation":"TokenQueryImpl.userIdLike(String) adds a LIKE filter on the token's user id. Passing null triggers FlowableIllegalArgumentException because a null pattern is invalid as a SQL LIKE criterion. Validation happens at query-build time, before any database access.","triggerScenarios":"Calling TokenQuery.userIdLike(null) in a createTokenQuery() chain with an uninitialized or optional filter variable.","commonSituations":"Optional search filters from REST query parameters; DTO fields left null; code that applies every available criterion without null-guards.","solutions":["Provide a non-null pattern such as \"%admin%\".","Apply the criterion conditionally when the filter value is present.","Omit the call to search across all user ids."],"exampleFix":"// before\nTokenQuery q = identityService.createTokenQuery().userIdLike(filter.userIdLike);\n\n// after\nTokenQuery q = identityService.createTokenQuery();\nif (filter.userIdLike != null && !filter.userIdLike.isEmpty()) {\n    q = q.userIdLike(\"%\" + filter.userIdLike + \"%\");\n}","handlingStrategy":"validation","validationCode":"if (userIdLike == null) { userIdLike = \"%\"; } // or skip the call\nidentityService.createTokenQuery().userIdLike(userIdLike);","typeGuard":"boolean hasPattern(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    query.userIdLike(pattern);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"userIdLike is null\")) { /* skip criterion */ } else { throw e; }\n}","preventionTips":["Use a query-builder wrapper that applies criteria only for non-null values.","Sanitize LIKE patterns (escape % and _) while checking for null.","Prefer building queries conditionally from a filter DTO with Optional fields."],"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"}