{"record":{"id":"9844191df0770fbb","repo":"flowable/flowable-engine","slug":"cannot-use-executionids-together-with-excludelocal","errorCode":null,"errorMessage":"Cannot use executionIds together with excludeLocalVariables","messagePattern":"Cannot use executionIds together with excludeLocalVariables","errorType":"validation","errorClass":"org.flowable.common.engine.api.FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java","lineNumber":119,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Execution id is null\");\n        }\n        if (excludeLocalVariables) {\n            throw new FlowableIllegalArgumentException(\"Cannot use executionId together with excludeLocalVariables\");\n        }\n        this.executionId = executionId;\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQueryImpl executionIds(Set<String> executionIds) {\n        if (executionIds == null) {\n            throw new FlowableIllegalArgumentException(\"executionIds is null\");\n        }\n        if (executionIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of executionIds is empty\");\n        }\n        if (excludeLocalVariables) {\n            throw new FlowableIllegalArgumentException(\"Cannot use executionIds together with excludeLocalVariables\");\n        }\n        this.executionIds = executionIds;\n        return this;\n    }\n\n    public HistoricVariableInstanceQuery activityInstanceId(String activityInstanceId) {\n        this.activityInstanceId = activityInstanceId;\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQuery taskId(String taskId) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n        if (excludeTaskRelated) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskId together with excludeTaskVariables\");\n        }","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java#L101-L137","documentation":"HistoricVariableInstanceQueryImpl.executionIds() throws FlowableIllegalArgumentException when excludeLocalVariables(true) was already set. Execution-id filtering and local-variable exclusion are mutually exclusive for historic variable instance queries, so the builder rejects the combination at configuration time.","triggerScenarios":"Calling query.executionIds(set) after query.excludeLocalVariables(true) on the same query instance.","commonSituations":"Query-param mapping code that always applies excludeLocalVariables before the id filters; shared query objects reused across requests with exclusion pre-enabled.","solutions":["Drop the excludeLocalVariables(true) call when filtering by execution ids","Apply executionIds(...) before excludeLocalVariables(true), or skip exclusion when execution ids are present","Construct a new query per request to avoid pre-set exclusion flags"],"exampleFix":"// before\nquery.excludeLocalVariables(true);\nquery.executionIds(ids); // throws\n// after\nquery.executionIds(ids); // do not call excludeLocalVariables(true)","handlingStrategy":"validation","validationCode":"boolean excludeLocal = /* your exclude flag */;\nif (excludeLocal && executionIds != null && !executionIds.isEmpty()) {\n    throw new IllegalStateException(\"executionIds and excludeLocalVariables are mutually exclusive\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    query.executionIds(executionIds);\n} catch (FlowableIllegalArgumentException e) {\n    // handle conflicting query options\n}","preventionTips":["Do not enable excludeLocalVariables when filtering by execution ids","Enforce option-compatibility rules in a single query-builder helper","Avoid reusing configured query objects across requests"],"tags":[],"backgroundTag":null,"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"}