Portal Community

When to Use

Configuration

No configuration required. The Break node has zero settings. Place it inside a Loop node's body branch and connect it from a conditional branch (typically the false or matching port of an IfCondition node). It executes and signals the loop the moment it is reached.

How It Works

When a Break node executes, it calls Memory.SignalBreak(), which writes a break signal into ExecutionMemory. The enclosing Loop node monitors for this signal after each body iteration. On detecting the signal, the Loop node:

  1. Stops firing the body port for any remaining items in the array.
  2. Clears the break signal from ExecutionMemory.
  3. Fires its done port to continue the workflow with post-loop logic.

All variables and output data accumulated during completed iterations remain intact and accessible on the done port path.

Output Ports

PortNotes
noneThe Break node has no output port of its own. It signals the enclosing Loop, which then fires its own done port. Do not connect any downstream node directly from Break — execution continues from the Loop's done port.

OutputData Fields

Break itself writes no output data fields. After a Break exits the loop, the Loop node's done port output data reflects the state at the time of the Break:

Field (on Loop node)TypeDescription
current_indexintThe 0-based index of the item at which the Break fired — i.e., the last item that was fully or partially processed.
collection_sizeintTotal number of elements in the original array (unchanged by the early exit).
itemsarrayThe full original array.

Placement Requirements

Must be inside a Loop body: Break must be placed within the subgraph connected to a Loop node's body port. If Break is executed outside a loop context, the engine raises a runtime error: ERR_BREAK_OUTSIDE_LOOP. There is no configuration that makes Break valid outside a loop.

Node Policies and GuardRails

Pattern Examples

Pattern 1 — Find-First Match (Rule Engine)

Loop over prioritised pricing rules. The first rule that matches the order is captured, then Break exits the loop. Downstream logic uses only the first-matched rule.

VariableAssignment  [key: "initMatch"]
  matchedRule = null
  └─► Loop  [key: "evalRules"]
        Items: {{ $var.pricingRules }}
        ├─► body ──► IfCondition  [key: "checkRule"]
        │             Condition: {{ $var.current_item.minAmount <= $json.orderTotal &&
        │                           $var.current_item.tier === $json.customerTier }}
        │             ├─► true  ──► VariableAssignment  (matchedRule = current_item)
        │             │               └─► Break
        │             └─► false ──► (end of iteration — loop advances to next item)
        └─► done ──► IfCondition
                       Condition: {{ $var.matchedRule !== null }}
                       ├─► true  ──► [apply matched rule discount]
                       └─► false ──► [apply default pricing]

Pattern 2 — Cart Validation with Early Stop

Check stock for each cart item. Exit as soon as any item is out of stock, returning an error to the user without unnecessary API calls for remaining items.

Loop  [key: "validateCart"]
  Items: {{ $json.cartItems }}
  ├─► body ──► HttpRequest  [key: "stockCheck"]
  │             GET /inventory/{{ $var.current_item.sku }}
  │             └─► IfCondition
  │                   Condition: {{ $output.stockCheck.available === false }}
  │                   ├─► true  ──► VariableAssignment
  │                   │             (outOfStockSku = $var.current_item.sku)
  │                   │               └─► Break
  │                   └─► false ──► (continue to next item)
  └─► done ──► IfCondition
                 Condition: {{ $var.outOfStockSku !== null }}
                 ├─► true  ──► HttpRequest  (POST /checkout/error, sku out of stock)
                 └─► false ──► [proceed to payment]

Pattern 3 — Supplier Fallback with First-Available

Try suppliers in preference order. Break as soon as the first available supplier is found. Use the captured supplier for the order without querying remaining suppliers.

VariableAssignment (selectedSupplier = null)
  └─► Loop  [key: "findSupplier"]
        Items: {{ $var.supplierList }}
        ├─► body ──► HttpRequest  [key: "querySupplier"]
        │             GET {{ $var.current_item.apiUrl }}/availability
        │             └─► IfCondition
        │                   Condition: {{ $output.querySupplier.inStock === true }}
        │                   ├─► true  ──► VariableAssignment
        │                   │             (selectedSupplier = current_item)
        │                   │               └─► Break
        │                   └─► false ──► (try next supplier)
        └─► done ──► [place order with $var.selectedSupplier]

Sample Output

Success Port

Break produces no data output. When the break condition is met, the loop exits and execution continues on the node connected to the loop's exit port. No JSON payload is emitted.

{
  "_control": "break",
  "_loopExited": true,
  "_iterationIndex": 5,
  "_reason": "Break condition met: found target record"
}

Expression Reference

ExpressionDescription
{{ $output.loopNode._control }}Always "break" — confirms loop exited via Break.
{{ $output.loopNode._iterationIndex }}The iteration index at which the break occurred.
{{ $output.loopNode._loopExited }}true — indicates the loop did not run to natural completion.