{"record":{"id":"8b36fb77f9522d64","repo":"flowable/flowable-engine","slug":"userid-is-null-8b36fb","errorCode":null,"errorMessage":"userId is null","messagePattern":"userId 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":825,"sourceCode":"    }\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) {\n            this.currentOrQueryObject.involvedUserIdentityLink = new IdentityLinkQueryObject(userId, null, identityLinkType);\n        } else {\n            this.involvedUserIdentityLink = new IdentityLinkQueryObject(userId, null, identityLinkType);\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQuery involvedGroup(String groupId, String identityLinkType) {\n        if (groupId == null) {\n            throw new FlowableIllegalArgumentException(\"groupId is null\");\n        }\n        if (identityLinkType == null) {","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L807-L843","documentation":"The two-argument CaseInstanceQueryImpl.involvedUser(String userId, String identityLinkType) throws FlowableIllegalArgumentException when userId is null. This variant filters case instances by a specific identity link type (e.g. participant, owner) for a user, so both parts are required to build the identity-link filter.","triggerScenarios":"Calling involvedUser(null, \"participant\") or passing a null user id captured from a UI filter or API payload into the two-argument overload.","commonSituations":"Task/case dashboards that filter by user role on cases where the logged-in user id was not resolved (no authenticated principal) before the query was built.","solutions":["Validate userId is non-null (and typically non-blank) before calling the two-argument involvedUser.","Resolve the user id from the authenticated context first; refuse to run the query when it cannot be resolved.","If the identity-link filter is optional, guard the whole call behind a null/empty check on the filter object.","Fix the deserialization/binding layer that produced a null userId."],"exampleFix":"// before\nquery.involvedUser(userContext.getUserId(), \"participant\");\n// after\nString userId = userContext.getUserId();\nif (userId != null) {\n    query.involvedUser(userId, \"participant\");\n}","handlingStrategy":"validation","validationCode":"if (userId == null) {\n    throw new IllegalArgumentException(\"userId required for involvedUser(userId, identityLinkType)\");\n}\nquery.involvedUser(userId, identityLinkType);","typeGuard":"boolean canFilterByUser(String userId) {\n    return userId != null && !userId.isBlank();\n}","tryCatchPattern":"try {\n    query.involvedUser(userId, identityLinkType);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Invalid involvedUser filter: {}\", e.getMessage());\n    throw new BadRequestException(\"userId is required\", e);\n}","preventionTips":["Validate both parameters of the two-argument overload before calling it","Map authenticated principal to userId before query construction","Treat identity-link filters as mandatory-input filters and validate at the API boundary"],"tags":["java","flowable","query-builder","null-check","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"}