{"record":{"id":"07792131cba5be48","repo":"flowable/flowable-engine","slug":"involveduser-is-null","errorCode":null,"errorMessage":"involvedUser is null","messagePattern":"involvedUser is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java","lineNumber":1082,"sourceCode":"    }\n    \n    @Override\n    public HistoricCaseInstanceQuery 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 HistoricCaseInstanceQuery 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 HistoricCaseInstanceQuery 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":1064,"sourceCodeEnd":1100,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L1064-L1100","documentation":"HistoricCaseInstanceQueryImpl.involvedUser(String) throws FlowableIllegalArgumentException when the userId is null. Involvement filtering requires an actual user id to match identity links; a null userId would make the predicate meaningless, so the library validates eagerly.","triggerScenarios":"Calling involvedUser(null) on a HistoricCaseInstanceQuery, directly or inside an or() block, before executing the query.","commonSituations":"Current-user resolution (e.g. from SecurityContext/authentication) returned null for anonymous requests; a form or REST parameter was optional and bound to null; user id variable lost during refactoring.","solutions":["Check the userId for null/blank before adding the involvement filter.","Resolve the current user properly and handle the unauthenticated case before building the query.","If involvement is optional, conditionally add the filter only when a user id exists.","Validate upstream REST/REST-call inputs so null never reaches the query builder."],"exampleFix":"// before\nquery.involvedUser(userId); // userId may be null\n// after\nif (userId != null && !userId.isEmpty()) {\n    query.involvedUser(userId);\n}","handlingStrategy":"validation","validationCode":"if (userId == null || userId.isEmpty()) {\n    throw new IllegalArgumentException(\"userId is required\");\n}\nquery.involvedUser(userId);","typeGuard":"boolean hasText(String s) {\n    return s != null && !s.trim().isEmpty();\n}","tryCatchPattern":"try {\n    query.involvedUser(userId);\n} catch (FlowableIllegalArgumentException e) {\n    if (\"involvedUser is null\".equals(e.getMessage())) {\n        // handle unauthenticated/anonymous case\n    } else {\n        throw e;\n    }\n}","preventionTips":["Resolve and validate the current user before building involvement queries","Handle anonymous sessions explicitly instead of passing null user ids","Validate REST parameters for null/blank before query construction","Centralize user-id resolution in one guarded helper"],"tags":["java","flowable","cmmn","query","null-argument","identity-link"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}