{"record":{"id":"b9e3bd7ce57a9d93","repo":"flowable/flowable-engine","slug":"variablenames-are-null-or-empty","errorCode":null,"errorMessage":"variableNames are null or empty","messagePattern":"variableNames are null or empty","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java","lineNumber":660,"sourceCode":"        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedGroups = involvedGroups;\n        } else {\n            this.involvedGroups = involvedGroups;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery includeProcessVariables() {\n        this.includeProcessVariables = true;\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery includeProcessVariables(Collection<String> variableNames) {\n        if (variableNames == null || variableNames.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"variableNames are null or empty\");\n        }\n        includeProcessVariables();\n        this.variableNamesToInclude = new LinkedHashSet<>(variableNames);\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery withJobException() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withJobException = true;\n        } else {\n            this.withJobException = true;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery processInstanceTenantId(String tenantId) {","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java#L642-L678","documentation":"Flowable throws this FlowableIllegalArgumentException when HistoricProcessInstanceQuery.includeProcessVariables(Collection<String>) is called with a null or empty collection. The query builder validates arguments eagerly so invalid queries fail at build time rather than at execution time. Only non-empty collections of variable names are accepted.","triggerScenarios":"Calling includeProcessVariables(null) or includeProcessVariables(Collections.emptyList()) or any variableNames.isEmpty() collection on a HistoricProcessInstanceQuery.","commonSituations":"Passing a variableNames list assembled dynamically from config or user input that ends up null/empty; refactoring code that previously called includeProcessVariables() (no-arg, include all) to the filtered overload.","solutions":["Ensure the collection passed to includeProcessVariables is non-null and contains at least one variable name before calling it","If you intend to include ALL process variables, call the no-arg includeProcessVariables() overload instead","Guard with a fallback: if list is empty, use the no-arg overload or skip the call"],"exampleFix":"// before\nquery.includeProcessVariables(variableNames);\n// after\nif (variableNames == null || variableNames.isEmpty()) {\n    query.includeProcessVariables(); // include all\n} else {\n    query.includeProcessVariables(variableNames);\n}","handlingStrategy":"validation","validationCode":"if (variableNames == null || variableNames.isEmpty()) {\n    throw new IllegalArgumentException(\"variableNames must contain at least one name\");\n}","typeGuard":"boolean isValidVariableNames(Collection<String> names) {\n    return names != null && !names.isEmpty();\n}","tryCatchPattern":"try {\n    query.includeProcessVariables(variableNames);\n} catch (FlowableIllegalArgumentException e) {\n    query.includeProcessVariables(); // fallback: include all\n}","preventionTips":["Prefer the no-arg includeProcessVariables() when you want all variables","Validate collections before passing them into Flowable query builders","Don't map empty optional filter lists directly into includeProcessVariables(Collection)"],"tags":["flowable","query-builder","validation","null-argument"],"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-14T05:17:10.506Z"}