Contents

Merge

merge · Nodes · Utility

Combines multiple incoming values into one output.

Combines multiple required inputs into one output when the combined value is itself meaningful data. Supports collecting into arrays, merging objects, wrapping each input under a keyed object, or selecting a single input by index.

NOTE: Merge waits on all required sockets. Use it for required parallel inputs. If you are recombining mutually exclusive alternate branches, skip Merge and wire each branch to the same downstream socket. Otherwise the other sockets will wait indefinitely for branches that never arrive.

Merge is not a control-flow node and not a generic pipe adapter. Use switch, if, or selector for visible routing. If the next node is JS and needs several values, prefer named input_names on that JS node and wire inputs directly. Use Merge only when the next node truly needs a merged/selected/collected value.

Prefer named sockets over adapter Merge:

FetchUser.output  -> BuildContext.user
FetchPrefs.output -> BuildContext.prefs

with JS config:

{ "input_names": ["user", "prefs"] }

Avoid:

FetchUser.output  -> Merge.input_1
FetchPrefs.output -> Merge.input_2
Merge.output      -> BuildContext.input

unless BuildContext actually needs the Merge node's merged object/array semantics.

Config:

  • mode - list (collect into array), merge (deep merge objects), object (wrap each input under a key), or select (output only one branch by index)
  • input_count - number of input sockets (default: 2)
  • output_keys - array of keys for object mode (one per input, required when mode is object)
  • select_index - 0-based index of which input to select (0 to N-1, required when mode is select, default: 0)

Modes:

  • list: {a:1} + {b:2} → [{a:1}, {b:2}]
  • merge: {a:1} + {b:2} → {a:1, b:2} (later values win)
  • object: {a:1} + {b:2} with keys ["first", "second"] → {first: {a:1}, second: {b:2}}
  • select: {a:1} + {b:2} + {c:3} with index 1 → {b:2}

Object Mode Example:

Configuration:

  • mode: object
  • input_count: 3
  • output_keys: ["user", "settings", "metadata"]

Inputs:

  • input_1: { "id": 123 }
  • input_2: { "theme": "dark" }
  • input_3: { "version": "1.0" }

Output:

{
  "user": { "id": 123 },
  "settings": { "theme": "dark" },
  "metadata": { "version": "1.0" }
}

Select Mode Example:

Configuration:

  • mode: select
  • input_count: 3
  • select_index: 1

Inputs:

  • input_1: { "source": "api" }
  • input_2: { "source": "cache" }
  • input_3: { "source": "fallback" }

Output:

{ "source": "cache" }

Validation:

  • output_keys must have exactly input_count entries (for object mode)
  • Keys cannot be empty strings
  • Keys must be unique (no duplicates)
  • select_index must be >= 0 (for select mode)
  • select_index must be < input_count (for select mode)

Inputs: input_1, input_2, etc. Output: Combined result (or selected input value in select mode)

Data Piping Invariant#

A downstream node only sees what is explicitly wired into it. Effectful nodes do not carry upstream row data through their output. If you need to upsert a row after a side-effect (Discord Send, HTTP POST, etc.), you must still pipe the original data to the write node. Do not place write/upsert nodes in thin air expecting data to appear from an unrelated upstream branch.

Use select mode to pick the original payload:

[Prepare Row Data]
    ↓
[Discord Send] ────┐
    ↓              │
[Merge: select 0] ←┘
    ↓
[Upsert Row] ← receives original row data, not Discord response

Wire the original data source into the first input of the Merge node, and the effectful node's output into the second input. Set mode: select with select_index: 0 so the Merge passes through the original payload to the write node.

Inputs

  • input_1Required
  • input_2Required

Outputs

  • output

Configuration

FieldTypeRequiredDescription
input_countintegerNoNumber of input sockets (named input_1, input_2, etc.)
modeenum(list, merge, object, select)NoHow to combine inputs
output_keysarray<string>NoKeys for each input in object mode (must match input_count)
select_indexintegerNoIndex of input to select (0-based, for select mode)
base_configrecordNoShared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow).