# Release v1.13.2: Critical Bugfix
**Release Date**: 2025-12-16
**Type**: Critical Patch Release
---
## 🚨 Critical Bug Fix
### update_workflow Tool - Prevents Data Loss
**Issue**: The `update_workflow` tool had a critical design flaw where updating a single node would **overwrite the entire workflow**, causing data loss and unexpected behavior.
**Example of the Problem**:
```python
# User wants to update just one node's parameters
update_workflow(workflow_id="123", nodes=[{
"name": "HTTP Request",
"parameters": {"url": "https://new-url.com"}
}])
# BUG: This would DELETE all other nodes in the workflow!
```
**Root Cause**: The tool was doing a simple replace (`payload[key] = value`) instead of intelligently merging updates with existing workflow data.
---
## ✅ The Fix
Implemented **smart merge logic** for workflow updates:
### 1. Node Updates (Smart Merge)
- Existing nodes are identified by name
- Only specified fields in the update are changed
- Other nodes remain untouched
- New nodes can be added
```python
# Now this works correctly:
update_workflow(workflow_id="123", nodes=[{
"name": "HTTP Request",
"parameters": {"url": "https://new-url.com"}
}])
# Result: Only "HTTP Request" node is updated, all other nodes preserved
```
### 2. Connection Updates (Smart Merge)
- Connection dictionaries are merged instead of replaced
- Existing connections are preserved unless explicitly overridden
### 3. Other Fields (Simple Replace)
- Fields like `name`, `settings`, `staticData` are still replaced as expected
---
## 📊 Technical Details
**File Changed**: `src/n8n_workflow_builder/client.py` (lines 182-215)
**Implementation**:
```python
if key == 'nodes' and isinstance(value, list):
existing_nodes = {node.get('name'): node for node in payload.get('nodes', [])}
for update_node in value:
node_name = update_node.get('name')
if node_name and node_name in existing_nodes:
# Merge: update existing node fields
existing_nodes[node_name].update(update_node)
else:
# Add new node
existing_nodes[update_node.get('name')] = update_node
payload['nodes'] = list(existing_nodes.values())
```
---
## ⚠️ Impact
**Severity**: Critical - could cause data loss
**Affected Versions**: All versions prior to v1.13.2
**Recommendation**: Update immediately if you're using `update_workflow` in production
---
## 🔄 Migration Notes
No migration required. The fix is backward compatible and improves existing behavior.
---
## 🙏 Acknowledgments
This was a serious design flaw that has been corrected. Thank you for identifying and reporting this issue!