Repository: kestra-io/kestra
Issue: This is a test issue to validate my self hosted instance
Labels: enhancement

```yaml
id: errors
namespace: org.floworc.tests

tasks:
- id: failed
  type: org.floworc.core.tasks.scripts.Bash
  commands:
  - 'exit 1'
  errors:
  - id: 2nd
    type: org.floworc.core.tasks.debugs.Echo
    format: second {{task.id}}
```

The errors will not be triggers, need to be global to work or on `FlowableTask`

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/core/src/main/java/org/kestra/core/models/tasks/Task.java b/core/src/main/java/org/kestra/core/models/tasks/Task.java
index 5617726de5..d85255fecd 100644
--- a/core/src/main/java/org/kestra/core/models/tasks/Task.java
+++ b/core/src/main/java/org/kestra/core/models/tasks/Task.java
@@ -43,9 +43,6 @@ abstract public class Task {
     @Min(0)
     protected Integer timeout;
 
-    @Valid
-    protected List<Task> errors;
-
     public Optional<Task> findById(String id, RunContext runContext, TaskRun taskRun) throws IllegalVariableEvaluationException {
         if (this.getId().equals(id)) {
             return Optional.of(this);
@@ -64,13 +61,6 @@ public Optional<Task> findById(String id, RunContext runContext, TaskRun taskRun
             }
         }
 
-        if (this.errors != null) {
-            return this.errors
-                .stream()
-                .flatMap(throwFunction(task -> task.findById(id, runContext, taskRun).stream()))
-                .findFirst();
-        }
-
         if (this.isFlowable() && ((FlowableTask<?>) this).getErrors() != null) {
             Optional<Task> errorChilds = ((FlowableTask<?>) this).getErrors()
                 .stream()
diff --git a/core/src/main/java/org/kestra/core/tasks/flows/EachSequential.java b/core/src/main/java/org/kestra/core/tasks/flows/EachSequential.java
index c8e0e726be..21ee987bc2 100644
--- a/core/src/main/java/org/kestra/core/tasks/flows/EachSequential.java
+++ b/core/src/main/java/org/kestra/core/tasks/flows/EachSequential.java
@@ -18,6 +18,7 @@
 import org.kestra.core.models.flows.State;
 import org.kestra.core.models.tasks.FlowableTask;
 import org.kestra.core.models.tasks.ResolvedTask;
+import org.kestra.core.models.tasks.Task;
 import org.kestra.core.models.tasks.VoidOutput;
 import org.kestra.core.runners.FlowableUtils;
 import org.kestra.core.runners.RunContext;
@@ -29,6 +30,7 @@
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
+import javax.validation.Valid;
 
 @SuperBuilder
 @ToString
@@ -55,6 +57,9 @@
 public class EachSequential extends Sequential implements FlowableTask<VoidOutput> {
     private String value;
 
+    @Valid
+    protected List<Task> errors;
+
     @Override
     public List<TaskTree> tasksTree(String parentId, Execution execution, List<String> groups) throws IllegalVariableEvaluationException {
         return TreeService.sequential(
diff --git a/core/src/main/java/org/kestra/core/tasks/flows/Sequential.java b/core/src/main/java/org/kestra/core/tasks/flows/Sequential.java
index 0146115e8a..f75f8af33e 100644
--- a/core/src/main/java/org/kestra/core/tasks/flows/Sequential.java
+++ b/core/src/main/java/org/kestra/core/tasks/flows/Sequential.java
@@ -28,6 +28,9 @@
 @Getter
 @NoArgsConstructor
 public class Sequential extends Task implements FlowableTask<VoidOutput> {
+    @Valid
+    protected List<Task> errors;
+
     @Valid
     private List<Task> tasks;
 
diff --git a/core/src/main/java/org/kestra/core/tasks/flows/Switch.java b/core/src/main/java/org/kestra/core/tasks/flows/Switch.java
index 8f08822614..9adbcd1959 100644
--- a/core/src/main/java/org/kestra/core/tasks/flows/Switch.java
+++ b/core/src/main/java/org/kestra/core/tasks/flows/Switch.java
@@ -42,6 +42,9 @@ public class Switch extends Task implements FlowableTask<Switch.Output> {
     @Valid
     private List<Task> defaults;
 
+    @Valid
+    protected List<Task> errors;
+
     private String rendererValue(RunContext runContext) throws IllegalVariableEvaluationException {
         return runContext.render(this.value);
     }


Test patch:
diff --git a/core/src/test/resources/flows/valids/all-flowable.yaml b/core/src/test/resources/flows/valids/all-flowable.yaml
index c95a7e962f..17984a8ddc 100644
--- a/core/src/test/resources/flows/valids/all-flowable.yaml
+++ b/core/src/test/resources/flows/valids/all-flowable.yaml
@@ -19,15 +19,10 @@ tasks:
             format: "{{task.id}} > {{taskrun.value}}"
 
 
-  # Local Errors
-  - id: 2-local-errors
+  # Simple task
+  - id: 2-simple-task
     type: org.kestra.core.tasks.debugs.Return
     format: "{{task.id}}"
-# @TODO: not working, local errrors only works on FlowableTask
-#    errors:
-#      - id: 2-local-errors-1
-#        type: org.kestra.core.tasks.debugs.Return
-#        format: "{{task.id}}"
 
   # Sequential
   - id: 3-sequential
@@ -84,4 +79,4 @@ errors:
     format: "Error Trigger ! {{task.id}}"
   - id: error-2nd
     type: org.kestra.core.tasks.debugs.Return
-    format: "Error Trigger ! {{task.id}}"
\ No newline at end of file
+    format: "Error Trigger ! {{task.id}}"