Assert
Controlled node
Overview
The Assert node validates input data and directs workflow execution based on whether the data represents a valid state or an error condition. It checks for explicit error objects (objects containing an error property) and can optionally validate truthiness of values. When running in the editor, the node displays the evaluated value in a JSON viewer, making it useful for debugging and monitoring data flow.
Validation Logic
The node evaluates the input value in the following priority:
- Error Object Detection: If the input is an object with an
errorproperty, the node immediately fires theerrorevent - Truthiness Check (if Fail Only On Error is disabled): If the value is falsy (including the strings
"false","undefined", or"null"), the node fires theerrorevent - Pass: If neither condition above is met, the node fires the
passevent with the original value
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Triggers the assertion check | - |
| Value | Data | The data to validate for errors or truthiness | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Pass | Event | Fires when the input value passes validation (no error object and truthy, or Fail Only On Error is enabled) |
| Error | Event | Fires when the input contains an error object or fails truthiness validation |
Properties
| Property | Type | Description | Default |
|---|---|---|---|
| Fail Only On Error | Boolean | When enabled, the node only fires the error event for explicit error objects (objects with an error property). When disabled, falsy values (including "false", "null", "undefined" strings) also trigger the error event. | false |
Runtime Behavior and Defaults
The Assert node is a controlled node that executes only when triggered by the run event input. During execution:
- The node evaluates the
valueinput data - If running in the editor, the evaluated value is displayed in the node's UI panel (limited to 4MB of text for performance)
- The node fires exactly one output event: either
passorerror - When the
passevent fires, the original value is passed through as event data - When the
errorevent fires due to an error object, the error message is extracted and displayed in the editor
Default Behavior: By default, Fail Only On Error is disabled (false), meaning the node acts as both an error detector and a truthiness validator. Enable this option if you only want to catch explicit error objects while allowing falsy values (like 0, "", or null) to pass through.
Example Usage
Basic Error Handling
Connect a node that might produce an error (such as an API Request or Database Query) to the Assert node's value input. Connect the Assert node's pass event to continue the workflow on success, and connect the error event to handle failures:
[API Request] → [Assert] → (pass) → [Process Data]
↓
(error) → [Send Error Notification]
Debugging with Assert
Place an Assert node after any data-producing node to inspect values during development. The node's UI panel will display the data in a formatted JSON viewer when running in the editor:
[AI Write] → [Assert] → [Continue Workflow]
In this case, the Assert node acts as a "breakpoint" that allows you to inspect the AI output before it continues through the workflow.
Strict Error Checking
Enable Fail Only On Error when you want to allow empty strings, zero values, or null values to pass through, while only catching explicit error objects:
[Form Data] → [Assert (Fail Only On Error: true)] → (pass) → [Save to Database]
↓
(error) → [Show Validation Message]
This configuration ensures that user input containing falsy values (like an empty text field) doesn't trigger the error path, while actual system errors do.