{"record":{"id":"9f5afbf132d0c8be","repo":"flowable/flowable-engine","slug":"userid-is-null-9f5afb","errorCode":null,"errorMessage":"userId is null","messagePattern":"userId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java","lineNumber":606,"sourceCode":"            this.activeActivityIds = activityIds;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery involvedUser(String involvedUser) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricProcessInstanceQuery 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 HistoricProcessInstanceQuery involvedGroup(String groupId, String identityLinkType) {\n        if (groupId == null) {\n            throw new FlowableIllegalArgumentException(\"groupId is null\");\n        }\n        if (identityLinkType == null) {","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java#L588-L624","documentation":"HistoricProcessInstanceQuery.involvedUser(String userId, String identityLinkType) requires a non-null userId. Flowable throws FlowableIllegalArgumentException when userId is null because an identity-link filter without a user is meaningless. Validation is fail-fast at query-build time.","triggerScenarios":"Calling involvedUser(null, identityLinkType) — e.g. the userId comes from a nullable authenticated-user context, request parameter, or variable that was never assigned.","commonSituations":"Web controllers passing SecurityContext-derived usernames that are null for anonymous users; service methods forwarding optional user arguments; refactors that removed a default user value.","solutions":["Pass a non-null userId string to involvedUser","Null-check the userId first and skip the involvedUser criterion or use a different query when absent","Resolve the user identity upstream (e.g. require authentication) before building the query","If the intent is to query regardless of user, drop this criterion entirely"],"exampleFix":"// before\nquery.involvedUser(userId, IdentityLinkType.PARTICIPANT); // throws when userId == null\n// after\nif (userId != null) {\n    query.involvedUser(userId, IdentityLinkType.PARTICIPANT);\n}","handlingStrategy":"validation","validationCode":"if (userId == null) {\n    throw new IllegalArgumentException(\"userId is required for involvedUser filter\");\n}\nquery.involvedUser(userId, IdentityLinkType.PARTICIPANT);","typeGuard":"boolean isValidUserId(String userId) {\n    return userId != null && !userId.trim().isEmpty();\n}","tryCatchPattern":"try {\n    query.involvedUser(userId, identityLinkType);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().equals(\"userId is null\")) {\n        // fall back to a query without the involvedUser criterion\n    } else {\n        throw e;\n    }\n}","preventionTips":["Resolve the current user (auth context) before building user-scoped queries","Make userId a required, validated parameter in service methods","Never forward nullable request parameters into Flowable query criteria","Add null-checks in query-builder wrapper methods"],"tags":["flowable","null-check","identity-link","query-validation"],"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"}