{"record":{"id":"2e9d75d662eede24","repo":"flowable/flowable-engine","slug":"provided-execution-id-is-null-2e9d75","errorCode":null,"errorMessage":"Provided execution id is null","messagePattern":"Provided execution id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/EventSubscriptionQueryImpl.java","lineNumber":65,"sourceCode":"    public EventSubscriptionQueryImpl eventSubscriptionId(String id) {\r\n        if (eventSubscriptionId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided event subscription id is null\");\r\n        }\r\n        this.eventSubscriptionId = id;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl eventName(String eventName) {\r\n        if (eventName == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided event name is null\");\r\n        }\r\n        this.eventName = eventName;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl executionId(String executionId) {\r\n        if (executionId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided execution id is null\");\r\n        }\r\n        this.executionId = executionId;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl processInstanceId(String processInstanceId) {\r\n        if (processInstanceId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided process instance id is null\");\r\n        }\r\n        this.processInstanceId = processInstanceId;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl activityId(String activityId) {\r\n        if (activityId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided activity id is null\");\r\n        }\r\n        this.activityId = activityId;\r","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/EventSubscriptionQueryImpl.java#L47-L83","documentation":"Thrown by EventSubscriptionQueryImpl.executionId when a null execution id is passed as a query criterion. The eager validation ensures queries are well-formed when built; a null executionId filter is not a meaningful criterion and is rejected with ActivitiIllegalArgumentException. It points to a caller bug rather than an engine problem.","triggerScenarios":"Calling createEventSubscriptionQuery().executionId(null), often when the execution id comes from an Execution/DelegateExecution reference that is null or from a variable holding an optional id.","commonSituations":"Using execution.getId() inside a delegate where the execution is not yet available; ids stored in process variables that were not set; refactored code where an earlier execution lookup now returns null.","solutions":["Null-check the execution id and skip the executionId criterion when it is absent","Fix the upstream code that should supply a valid execution id (e.g. use execution.getId() of a live DelegateExecution)","If filtering by execution is conditional, build the query conditionally instead of passing null","Log/validate the id source to find why it is null at query time"],"exampleFix":"// before\nEventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery().executionId(execId);\n// after\nEventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery();\nif (execId != null) {\n    q = q.executionId(execId);\n}","handlingStrategy":"validation","validationCode":"if (executionId == null) { throw new IllegalArgumentException(\"executionId must be non-null before querying\"); }\nquery.executionId(executionId);","typeGuard":"boolean hasExecutionId(DelegateExecution e) { return e != null && e.getId() != null; }","tryCatchPattern":"try {\n    query.executionId(execId);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    // execId was null: verify you hold a live execution reference\n}","preventionTips":["Use execution.getId() from a live DelegateExecution rather than cached/stale references","Null-check ids from process variables before querying","Build criteria conditionally when the execution scope is uncertain"],"tags":["java","activiti","query","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-18T11:17:12.947Z"}