# Release v1.9.2: Fix create_workflow Active Field Bug
**Release Date:** 2025-12-16
## š Bug Fixes
### Fixed `create_workflow` Read-Only Field Error
**Problem:**
`create_workflow` tool failed with error:
```
Error: Failed to create workflow: {"message":"request/body/active is read-only"}
```
The tool was sending an `active` field in the workflow creation payload, but the n8n API treats this field as read-only and rejects it during creation.
**Root Cause:**
1. Tool schema included `active` parameter with default value `false`
2. Handler always added `active` field to workflow payload
3. n8n API rejects workflows with `active` field during POST `/api/v1/workflows`
**Solution:**
- Removed `active` parameter from tool schema
- Removed `active` field from workflow creation payload
- Read active status from API response instead
- Updated documentation to clarify workflows are inactive by default
## š§ Changes
### Tool Schema
**Before:**
```python
inputSchema={
"properties": {
"name": {"type": "string"},
"nodes": {"type": "array"},
"connections": {"type": "object"},
"active": {"type": "boolean", "default": false} # ā Read-only
}
}
```
**After:**
```python
inputSchema={
"properties": {
"name": {"type": "string"},
"nodes": {"type": "array"},
"connections": {"type": "object"}
# ā
No 'active' field
}
}
```
### Handler Code
**Before:**
```python
active = arguments.get("active", False)
workflow_data = {
"name": name_arg,
"nodes": nodes,
"connections": connections,
"active": active, # ā Causes API error
"settings": settings
}
```
**After:**
```python
# Note: 'active' is read-only and cannot be set during creation
workflow_data = {
"name": name_arg,
"nodes": nodes,
"connections": connections,
"settings": settings # ā
No 'active' field
}
# Read status from response
is_active = created_workflow.get("active", False)
```
### Response Message
**Before:**
```
Status: š¢ Active / āŖ Inactive
Next Steps:
- Activate with: update_workflow(workflow_id="...", active=true)
```
**After:**
```
Status: āŖ Inactive (default)
Next Steps:
- Activate in n8n UI if needed (workflows are inactive by default)
```
## š Technical Details
### n8n API Behavior
The n8n API treats `active` as a **read-only field** during workflow creation:
- ā
**GET** `/api/v1/workflows/{id}` - Returns `active` field
- ā
**PUT** `/api/v1/workflows/{id}` - Cannot modify `active` (also read-only)
- ā **POST** `/api/v1/workflows` - Rejects if `active` is present
**Why?**
The `active` field is managed internally by n8n and can only be changed through the n8n UI, not via API. This is a security/safety feature to prevent accidental activation of workflows via API.
### Workflow Activation
To activate workflows after creation:
1. **Via n8n UI**: Toggle the workflow active/inactive switch
2. **Not possible via API**: The `update_workflow` tool also cannot change `active` status
This was already documented in `update_workflow` tool:
> "Note: The 'active' field is read-only and cannot be changed via API - use the n8n UI instead."
## š Additional Improvements
### Enhanced Error Logging
Added detailed error logging to `create_workflow` in `client.py`:
```python
except httpx.HTTPStatusError as e:
error_detail = e.response.text
logger.error(f"Failed to create workflow: {error_detail}")
logger.error(f"Payload sent: {json.dumps(workflow, indent=2)}")
raise Exception(f"Failed to create workflow: {error_detail}")
```
This helps debug API errors by showing:
- Full error response from n8n
- Complete payload that was sent
- Makes troubleshooting much easier
## ā
Impact
### Before v1.9.2:
```
create_workflow(name="Test", nodes=[...], connections={...})
ā ā Error: request/body/active is read-only
ā Workflow creation impossible
```
### After v1.9.2:
```
create_workflow(name="Test", nodes=[...], connections={...})
ā ā
Workflow Created: Test
ā Status: āŖ Inactive (default)
ā ID: abc123
```
## šÆ Testing
Tested with complex multi-node workflow:
```python
create_workflow(
name="Error Test - Complex Multi-Failure",
nodes=[
# Manual Trigger
# HTTP Request (invalid domain)
# Code Node (intentional error)
# IF Node
# Another HTTP Request (500 error)
# Error Trigger
# Format Error Code Node
],
connections={...}
)
```
Result: ā
Workflow created successfully
## š§ Files Changed
### Modified Files
- `src/n8n_workflow_builder/server.py`
- Removed `active` parameter from tool schema
- Removed `active` field from workflow_data
- Read `active` from API response
- Updated next steps message
- `src/n8n_workflow_builder/client.py`
- Added detailed error logging to `create_workflow`
- Logs full error response and payload
## š Documentation Updates
Updated tool description to clarify:
> "Note: Workflows are created inactive by default and must be activated in the n8n UI."
This makes it clear that:
- Workflows start inactive
- Activation requires manual UI action
- This is by design for safety
## š Usage
```python
# Create workflow (always inactive by default)
workflow = create_workflow(
name="My Workflow",
nodes=[...],
connections={...}
)
# Returns: Status: āŖ Inactive (default)
# To activate:
# 1. Open n8n UI
# 2. Find workflow
# 3. Toggle active switch
```
## š Benefits
ā
**`create_workflow` now works** - Critical functionality restored
ā
**Clear documentation** - Users know workflows start inactive
ā
**Better error messages** - Detailed logging helps debugging
ā
**API compliance** - Respects n8n's read-only field constraints
---
**Full Changelog**: v1.9.1...v1.9.2