{"record":{"id":"527b0d7076b33da7","repo":"flowable/flowable-engine","slug":"owner-is-null-527b0d","errorCode":null,"errorMessage":"Owner is null","messagePattern":"Owner is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":410,"sourceCode":"        if (assigneeLike != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike\");\n        }\n        if (assigneeLikeIgnoreCase != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.assigneeIds = assigneeIds;\n        } else {\n            this.assigneeIds = assigneeIds;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskOwner(String owner) {\n        if (owner == null) {\n            throw new ActivitiIllegalArgumentException(\"Owner is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.owner = owner;\n        } else {\n            this.owner = owner;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskOwnerLike(String ownerLike) {\n        if (ownerLike == null) {\n            throw new ActivitiIllegalArgumentException(\"Owner is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.ownerLike = ownerLike;\n        } else {\n            this.ownerLike = ownerLike;","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L392-L428","documentation":"taskOwner(String owner) validates its argument and throws ActivitiIllegalArgumentException when the passed owner is null. The query API requires an actual owner string to build the T.OWNER_ filter; a null would silently produce a broken or meaningless WHERE clause. Pass a non-null user id, or do not call the method at all.","triggerScenarios":"Calling taskQuery.taskOwner(null), typically when the owner value comes from a variable, request parameter, or optional lookup that resolved to null.","commonSituations":"Passing a process variable that was never initialized; wiring a null from a form field or REST payload; using a user lookup that returned null for an unknown user id.","solutions":["Ensure the owner value is non-null before building the query (skip the filter if null)","Default the value to a sentinel such as an empty string only if your data model actually stores that","Fix the upstream source (variable, form, REST body) so the owner is always provided when this query runs"],"exampleFix":"// before\nString owner = (String) execution.getVariable(\"owner\");\nquery.taskOwner(owner); // throws if variable missing\n// after\nString owner = (String) execution.getVariable(\"owner\");\nif (owner != null) { query.taskOwner(owner); }","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(owner, \"owner must not be null\");\nquery.taskOwner(owner);","typeGuard":"boolean hasOwner(String owner) { return owner != null && !owner.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskOwner(owner);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Skipping owner filter: {}\", e.getMessage());\n}","preventionTips":["Null-check user ids sourced from variables, forms, or REST payloads before building queries","Use Optional.ofNullable(owner).ifPresent(query::taskOwner)","Ensure user lookups return empty-optional semantics you can branch on, not null"],"tags":["task-query","null-argument","query-builder","activiti"],"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"}