{"record":{"id":"7cc049c3495c4899","repo":"flowable/flowable-engine","slug":"execution-id-is-null-7cc049","errorCode":null,"errorMessage":"Execution id is null","messagePattern":"Execution id is null","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":101,"sourceCode":"            throw new FlowableIllegalArgumentException(\"processInstanceId is null\");\n        }\n        this.processInstanceId = processInstanceId;\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQuery processInstanceIds(Collection<String> processInstanceIds) {\n        if (processInstanceIds == null || processInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"processInstanceIds is empty\");\n        }\n        this.processInstanceIds = processInstanceIds;\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQueryImpl executionId(String executionId) {\n        if (executionId == null) {\n            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\");","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java#L83-L119","documentation":"HistoricVariableInstanceQueryImpl.executionId requires a non-null execution id and also rejects being combined with excludeLocalVariables. Passing null throws this FlowableIllegalArgumentException before the query is executed. This keeps invalid queries from producing undefined result sets.","triggerScenarios":"Calling createHistoricVariableInstanceQuery().executionId(null), e.g. when the execution id is taken from a nullable variable or an execution that was not started; also indirectly when excludeLocalVariables is set first with a null id.","commonSituations":"Delegates or listeners run outside a normal execution context returning null ids; optional path parameters; API changes where executionId became optional but the call site was not updated.","solutions":["Check the execution id for null and skip the clause when absent","Fetch the id from a reliable source (DelegateExecution.getId()) before querying","Do not call excludeLocalVariables together with executionId; choose one constraint","Use processInstanceId instead when the execution id is unavailable"],"exampleFix":"// before\nquery.executionId(executionId).excludeLocalVariables();\n// after\nif (executionId != null) {\n    query.executionId(executionId);\n}","handlingStrategy":"validation","validationCode":"if (executionId == null || executionId.isBlank()) {\n    throw new IllegalArgumentException(\"executionId required for this query\");\n}\nquery.executionId(executionId); // and do NOT also call excludeLocalVariables","typeGuard":"static boolean hasExecutionId(String eid) {\n    return eid != null && !eid.isBlank();\n}","tryCatchPattern":"try {\n    query.executionId(eid);\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    // fall back to processInstanceId or skip the query\n}","preventionTips":["Never combine executionId with excludeLocalVariables","Resolve execution ids from DelegateExecution before querying","Null-check optional path/parameter ids before clause construction","Prefer processInstanceId when only the instance is known"],"tags":["flowable","query","null","history"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}