{"record":{"id":"9b251ed258d925cb","repo":"flowable/flowable-engine","slug":"planitemdefinitionids-is-null-9b251e","errorCode":null,"errorMessage":"planItemDefinitionIds is null","messagePattern":"planItemDefinitionIds 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":799,"sourceCode":"    }\n    \n    @Override\n    public CaseInstanceQuery activePlanItemDefinitionId(String planItemDefinitionId) {\n        if (planItemDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"planItemDefinitionId is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.activePlanItemDefinitionId = planItemDefinitionId;\n        } else {\n            this.activePlanItemDefinitionId = planItemDefinitionId;\n        }\n        return this;\n    }\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;","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L781-L817","documentation":"Flowable's CaseInstanceQueryImpl throws FlowableIllegalArgumentException when activePlanItemDefinitionIds(Set<String>) is called with a null set. The query builder validates arguments eagerly so that an invalid query fails at construction time rather than producing a broken SQL query at execution time.","triggerScenarios":"Calling caseInstanceQuery().activePlanItemDefinitionIds(null) directly, or passing a null field/variable into the method, either at top level or inside an or() block.","commonSituations":"Building queries dynamically where the set of plan item definition ids comes from an upstream lookup or configuration that returned null (e.g. a missing deployment, a null return from a service, or an uninitialized field in a search filter DTO).","solutions":["Ensure the caller computes a non-null Set before calling activePlanItemDefinitionIds (e.g. Collections.emptySet() when no filter is intended).","If the filter is optional, only call activePlanItemDefinitionIds when the set is non-null instead of always calling it.","Trace where the null set originates (config, DB lookup, REST payload) and fix that producer to return an empty set.","Wrap the call and surface a clear message to the end user that the planItemDefinitionIds filter was missing."],"exampleFix":"// before\nquery.activePlanItemDefinitionIds(filter.getPlanItemDefinitionIds());\n// after\nif (filter.getPlanItemDefinitionIds() != null) {\n    query.activePlanItemDefinitionIds(filter.getPlanItemDefinitionIds());\n}","handlingStrategy":"validation","validationCode":"if (planItemDefinitionIds == null) {\n    throw new IllegalArgumentException(\"planItemDefinitionIds must not be null\");\n}\nquery.activePlanItemDefinitionIds(planItemDefinitionIds);","typeGuard":"boolean isValidFilter(Set<String> ids) {\n    return ids != null;\n}","tryCatchPattern":"try {\n    query.activePlanItemDefinitionIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid planItemDefinitionIds filter: {}\", e.getMessage());\n    // rethrow or fall back to unfiltered query\n}","preventionTips":["Null-check optional filter fields before applying them to the query","Initialize set-typed DTO fields to empty collections, never null","Only chain filter methods when the corresponding input is present","Fail fast in the web/controller layer with clear validation messages"],"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-14T05:17:10.506Z"}