{"record":{"id":"f75e7c7e228cdbfa","repo":"flowable/flowable-engine","slug":"involveduser-is-null-f75e7c","errorCode":null,"errorMessage":"involvedUser is null","messagePattern":"involvedUser is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java","lineNumber":812,"sourceCode":"    }\n    \n    @Override\n    public CaseInstanceQuery activePlanItemDefinitionIds(Set<String> planItemDefinitionIds) {\n        if (planItemDefinitionIds == null) {\n            throw new FlowableIllegalArgumentException(\"planItemDefinitionIds is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.activePlanItemDefinitionIds = planItemDefinitionIds;\n        } else {\n            this.activePlanItemDefinitionIds = planItemDefinitionIds;\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQuery involvedUser(String userId) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"involvedUser is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedUser = userId;\n        } else {\n            this.involvedUser = userId;\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQuery involvedUser(String userId, String identityLinkType) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"userId is null\");\n        }\n        if (identityLinkType == null) {\n            throw new FlowableIllegalArgumentException(\"identityLinkType is null\");\n        }\n        if (inOrStatement) {","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L794-L830","documentation":"CaseInstanceQueryImpl.involvedUser(String) throws FlowableIllegalArgumentException when the userId argument is null. Flowable validates query parameters at query-construction time because a null involved user cannot be translated into a meaningful SQL filter on the identity-link join.","triggerScenarios":"Calling caseInstanceQuery().involvedUser(null), typically when the userId comes from a variable, request parameter, or security context that was not populated.","commonSituations":"REST endpoints that pass through an unauthenticated/anonymous user id, spring-security contexts without a principal, or form filters where the 'involved user' field was left blank but the filter is applied unconditionally.","solutions":["Check the userId for null/blank before invoking involvedUser and skip the filter when absent.","Fix the upstream source of the userId (auth context, request param parsing) so it is always populated when this filter is used.","For an anonymous search, use a different query path that does not involve involvement filtering.","Log and reject the request early with a clear 'involved user required' validation message."],"exampleFix":"// before\nquery.involvedUser(request.getUserId());\n// after\nif (request.getUserId() != null && !request.getUserId().isBlank()) {\n    query.involvedUser(request.getUserId());\n}","handlingStrategy":"validation","validationCode":"if (userId == null || userId.isBlank()) {\n    throw new IllegalArgumentException(\"involvedUser must not be null or blank\");\n}\nquery.involvedUser(userId);","typeGuard":"boolean hasUser(String userId) {\n    return userId != null && !userId.isBlank();\n}","tryCatchPattern":"try {\n    query.involvedUser(userId);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"involvedUser filter skipped: {}\", e.getMessage());\n}","preventionTips":["Resolve the current user id before building the query and reject requests missing it","Guard optional user filters behind null/blank checks","Don't pass security-context values straight into query builders without checks"],"tags":["java","flowable","query-builder","null-check"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}