Skip to content
Data & Databases

Ghost Connection Repair for n8n Workflow JSON with Patch Log

9 nodes 7 0 Manual trigger
Download

Loading workflow…

Workflow Description

A fully self-contained workflow that inspects a local n8n workflow export and removes only dangling connections. A Code node accepts workflowJson as an object or JSON string, validates the nodes array, connections object and node-name uniqueness, then deep-copies the export and deletes exclusively source keys with no matching node plus destination links pointing to missing nodes, keeping valid sibling links. Every removal is recorded in patchLog with path, reason and removed value. A second verification pass requires remainingDanglingCount to be zero; IF routes on repairSafe, Set nodes expose counts and a final Code node returns one audit report.

How it works

  1. 1.Manual Trigger fires with an empty item.
  2. 2.Load Sample Workflow Exports emits three fictional cases.
  3. 3.Repair Dangling Connections parses, validates, deep-copies, strips ghost connections and logs them.
  4. 4.A second pass computes remainingDanglingCount and repairSafe.
  5. 5.If Repair Safe splits verified repairs from blocked cases.
  6. 6.Two Set nodes add status and summaryLine with detected/removed/remaining counts.
  7. 7.Merge (append) then Build Audit Report returns exactly one report item.

Use cases

  • Clean a workflow export before import to avoid Destination node not found
  • Audit every removed connection before applying the change
  • Scan batches of workflow files for missing node references

Requirements

  • n8n instance supporting the listed node type versions
  • workflowJson field containing a workflow export object or valid JSON string
  • No credentials needed; no external calls are made
  • Keep the originalWorkflow output yourself; the workflow writes no files

Setup and testing in n8n

  1. Import the JSON and open the workflow.
  2. Click Execute Workflow and inspect Build Audit Report output.
  3. Confirm case-A-dangling shows detected 2, removed 2, remaining 0 with two patch reasons.
  4. Confirm case-B-duplicate-names is blocked with duplicate_node_names and case-C-broken-json with invalid_json.
  5. Edit the sample node to add a fully valid workflow and verify patchLog stays empty.

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code If Set No Op Merge

Details

Trigger Manual trigger
Nodes 9
Apps 6
Views 7
Downloads 0

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (9)

/

Manual Trigger

Manual Trigger

#1

Load Sample Workflow Exports

Code

#2

Repair Dangling Connections

Code

#3

If Repair Safe

If

#4

Set Repaired Summary

Set

#5

Set Blocked Summary

Set

#6

Mark Blocked For Review

No Op

#7

Merge Branches

Merge

#8

Build Audit Report

Code

#9

Note Input

Sticky Note

#10

Note Repair

Sticky Note

#11

Note Routing

Sticky Note

#12
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime