Fail Fail

yaml
type: "io.kestra.core.tasks.executions.Fail"

Fail the execution.

Used to fail the execution, for example, on a switch branch or on some conditions based on the execution context.

Examples

Fail on a switch branch

yaml
id: fail-on-switch
namespace: io.kestra.tests

inputs:
  - id: param
    type: STRING
    required: true

tasks:
  - id: switch
    type: io.kestra.core.tasks.flows.Switch
    value: "{{inputs.param}}"
    cases:
      case1:
        - id: case1
          type: io.kestra.core.tasks.log.Log
          message: Case 1
      case2:
        - id: case2
          type: io.kestra.core.tasks.log.Log
          message: Case 2
      notexist:
        - id: fail
          type: io.kestra.core.tasks.executions.Fail
      default:
        - id: default
          type: io.kestra.core.tasks.log.Log
          message: default

Fail on a condition

yaml
id: fail-on-condition
namespace: io.kestra.tests

inputs:
  - name: param
    type: STRING
    required: true

tasks:
  - id: before
    type: io.kestra.core.tasks.debugs.Echo
    format: I'm before the fail on condition 
  - id: fail
    type: io.kestra.core.tasks.executions.Fail
    condition: '{{ inputs.param == "fail" }}'
  - id: after
    type: io.kestra.core.tasks.debugs.Echo
    format: I'm after the fail on condition 

Properties

condition

  • Type: string
  • Dynamic: ✔️
  • Required:

Optional condition, must coerce to a boolean. Boolean coercion allows 0, -0, and '' to coerce to false, all other values to coerce to true.

errorMessage

  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: Task failure

Optional error message.