diff --git a/core/src/main/java/io/kestra/core/runners/ExecutorService.java b/core/src/main/java/io/kestra/core/runners/ExecutorService.java index f24dc0e585..25b380cc52 100644 --- a/core/src/main/java/io/kestra/core/runners/ExecutorService.java +++ b/core/src/main/java/io/kestra/core/runners/ExecutorService.java @@ -628,7 +628,9 @@ public Execution addDynamicTaskRun(Execution execution, Flow flow, WorkerTaskRes } public boolean canBePurged(final Executor executor) { - return conditionService.isTerminatedWithListeners(executor.getFlow(), executor.getExecution()) + return executor.getFlow() != null && + // is terminated + conditionService.isTerminatedWithListeners(executor.getFlow(), executor.getExecution()) // we don't purge pause execution in order to be able to restart automatically in case of delay && executor.getExecution().getState().getCurrent() != State.Type.PAUSED // we don't purge killed execution in order to have feedback about child running tasks