Skip to main content

Overview

The nodeExecutionErrorActivity updates the node’s data in the database with execution status information when an error occurs. This ensures that node state reflects the execution failure.

Purpose

  • Update node state with error information
  • Persist execution status in node data
  • Enable error recovery and retry logic
  • Maintain node state consistency

When it’s executed

This activity is called during error handling:
  1. On workflow failure: When an error occurs during node execution
  2. After error logging: Typically called after logging the error
  3. Before status notification: Executes before notifying users of the failure

Signature

async nodeExecutionErrorActivity({
  nodeId: string,
  nodeData: any,
  executionStatus: string
}): Promise<void>

Inputs

ParameterTypeDescription
nodeIdstringID of the node that encountered an error
nodeDataanyCurrent node data object to update
executionStatusstringExecution status string (typically "FAILED")

Outputs

Returns void. The activity completes when the node data is successfully updated.

Implementation details

The activity updates the flows_nodes table, merging the execution status into the node’s data JSON field:
UPDATE flows_nodes 
SET data = $1::jsonb 
WHERE node_id = $2
The update merges the executionStatus into the existing nodeData object, preserving other node configuration while adding the error status.

Example usage in workflow

// In error handling block
await nodeExecutionErrorActivity({
  nodeId,
  nodeData: node.data,
  executionStatus: 'FAILED',
});

Execution status values

StatusDescriptionWhen used
FAILEDNode execution failedWhen an error occurs during execution
PENDINGNode execution pendingNot typically used by this activity
COMPLETEDNode execution completedNot typically used by this activity

Data structure

The activity merges the execution status into the node data:
const data = {
  ...nodeData,
  executionStatus,
};
This preserves all existing node configuration while adding the execution status field.

Error handling

The activity may throw an error if:
  • Database connection fails
  • The update query fails
  • The node ID doesn’t exist
  • JSON serialization fails
Errors in this activity are typically caught and logged, but don’t prevent the workflow from completing its error handling sequence.

Integration with error flow

This activity is part of the error handling sequence:
1

Log error

generateExecutionLogsActivity creates an error log entry
2

Update node data

nodeExecutionErrorActivity updates the node with error status
3

Notify user

notifyStatusActivity sends failure notification