{"record":{"id":"a7095d43a6f0740b","repo":"flowable/flowable-engine","slug":"plan-item-definition-types-is-empty-a7095d","errorCode":null,"errorMessage":"Plan item definition types is empty","messagePattern":"Plan item definition types is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java","lineNumber":248,"sourceCode":"    public PlanItemInstanceQuery planItemDefinitionType(String planItemDefinitionType) {\n        if (planItemDefinitionType == null) {\n            throw new FlowableIllegalArgumentException(\"Plan item definition type is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.planItemDefinitionType = planItemDefinitionType;\n        } else {\n            this.planItemDefinitionType = planItemDefinitionType;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemDefinitionTypes(List<String> planItemDefinitionTypes) {\n        if (planItemDefinitionTypes == null) {\n            throw new FlowableIllegalArgumentException(\"Plan item definition types is null\");\n        }\n        if (planItemDefinitionTypes.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Plan item definition types is empty\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.planItemDefinitionTypes = planItemDefinitionTypes;\n        } else {\n            this.planItemDefinitionTypes = planItemDefinitionTypes;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceName(String name) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"Name is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.name = name;\n        } else {\n            this.name = name;","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L230-L266","documentation":"Thrown by PlanItemInstanceQueryImpl.planItemDefinitionTypes when the list is empty. An empty IN-clause is invalid/meaningless SQL, so the builder rejects it immediately. Unlike the null check, this indicates data was present structurally but contained no values.","triggerScenarios":"Calling planItemInstanceQuery.planItemDefinitionTypes(Collections.emptyList()) or passing a newly-created List<String>() with no elements, often from an empty UI multi-select or empty query parameter.","commonSituations":"Users submit a filter form with no types checked; a JSON body like {\"types\": []} is mapped straight into the query builder.","solutions":["Only call planItemDefinitionTypes when the list is non-empty; otherwise omit the filter to match all types.","If the empty list should mean 'match nothing', add an impossible criterion deliberately or short-circuit the query and return no results.","Populate the list with valid types such as \"task\", \"humanTask\", \"stage\"."],"exampleFix":"// before\nquery.planItemDefinitionTypes(selectedTypes); // selectedTypes may be empty\n// after\nif (selectedTypes != null && !selectedTypes.isEmpty()) {\n    query.planItemDefinitionTypes(selectedTypes);\n}","handlingStrategy":"validation","validationCode":"if (types != null && !types.isEmpty()) {\n    planItemInstanceQuery.planItemDefinitionTypes(types);\n} // else: omit the filter to match all types","typeGuard":"boolean isNonEmpty(List<String> list) {\n    return list != null && !list.isEmpty();\n}","tryCatchPattern":"try {\n    query.planItemDefinitionTypes(types);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"Plan item definition types is empty\")) {\n        // rebuild the query without the types filter\n    } else {\n        throw e;\n    }\n}","preventionTips":["Treat an empty multi-select as 'no filter', not as an empty IN clause","Check list emptiness before handing collections to query builders","Document that empty collections are rejected by Flowable query APIs"],"tags":["cmmn","query","empty-collection","flowable"],"backgroundTag":"empty-required-field","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}