Coalesce Data between Branches

Describe the problem/error/question

  • I’m not able to coalesce the domain names between both branches within the Personalize Outreach Input node
  • If I try using the Merge node, both branches will execute instead of following the If logic.

Input Data Sample

[
  {
    "id": "4254864985",
    "title": "Recruiter - 12m FTC",
    "companyName": "GM Performance Power Units",
    "jobLink": "https://www.linkedin.com/jobs/view/recruiter-12m-ftc-at-gm-performance-power-units-4254864985?refId=PRVa0df1i51f7hVc0eUL4A%3D%3D&trackingId=GEhEMLiF66uAsYnrDLFptw%3D%3D&position=17&pageNum=15",
    "posterName": "Sam Green BSc (Hons). Assoc CIPD.",
    "posterUrl": "https://uk.linkedin.com/in/samantha-green-recruitment",
    "jobPosterTitle": "Group Talent Acquisition Manager | \nHiring Top Talent Worldwide | \nBuilding High-Performing Teams |\nDEI Advocate | Fueled by Lattes & LinkedIn ☕💻 |…",
    "seniorityLevel": "Associate",
    "industries": "Engines and Power Transmission Equipment Manufacturing and Staffing and Recruiting",
    "companyAddress": {
      "type": "PostalAddress",
      "addressLocality": "Concord",
      "addressRegion": "North Carolina",
      "postalCode": "28027",
      "addressCountry": "US"
    },
    "jobLocation": "Charlotte, NC",
    "searchId": 1,
    "scrapedTimestamp": "2025-07-14T10:45:20.310-04:00",
    "companySize": 26
  }
]

Information on your n8n setup

  • n8n version: 1.101.1
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Windows 10

Here’s exactly how I fixed it when I had the same problem in n8n:

I had an If node that split my workflow into two branches. In one branch I was enriching data (like extracting domain names), and in the other I was skipping that step. I needed to bring the data back together after the condition, but if I used a Merge node directly, n8n would wait for both branches to run, even if only one was supposed to continue based on the If result. That caused both branches to trigger regardless of the condition, which broke the logic.

To fix this, I added a No Operation node on the branch that wasn’t supposed to do anything. That way, both paths always reached the Merge node without triggering unnecessary logic. Then I connected both branches to a Merge node and set its mode to “Pass-through” using “Input 1” as the main data source. This let me combine the logic cleanly—only one branch’s real data continued, and the Merge didn’t force both to run fully. That kept my branching under control and let me proceed with a single flow that respected the logic I set in the If condition.

In your current flow, you can do the following, replace the current field in Personalize Outreach Input with:
{{ $(‘Get Domain Name’).first()?.item?.json?.domain || $(‘Extract Domain’).first()?.item?.json?.message?.content?.domain }}

You can also do either of the following:
Place a Merge node after “Get Domain Name” and “Extract Domain,” using, for example, Combine by Position mode. Then, read the consolidated value from the Merge node.

A single Set/Function manually consolidating
Create a Function node:

const domainFromGet = $('Get Domain Name').first()?.item?.json?.domain;
const domainFromExtract = $('Extract Domain').first()?.item?.json?.message?.content?.domain;
return [{ json: { domain: domainFromGet || domainFromExtract } }];

This ensures that there is always only one value and prevents empty branch errors.

I don’t see “Pass-through” as an option for the Merge node

Appreciate the suggestions, unfortunately, neither of the solutions have worked for me.

For some reason both branches keep executing regardless of what mode I sent the Merge node to

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.