N8N: RangeError: Invalid string length in Push.relayViaPubSub - Workflow succeeds but shows as failed
I'm experiencing a persistent RangeError: Invalid string length when processing large datasets in n8n. The workflow executes successfully and processes all data correctly, but fails during the post-execution phase, causing the execution to be marked as "failed" despite successful completion.
Error Details
Error Message:
There was a problem running hook "workflowExecuteAfter" RangeError: Invalid string length
at JSON.stringify (<anonymous>)
at Push.relayViaPubSub (/usr/local/lib/node_modules/n8n/src/push/index.ts:221:56)
at Push.send (/usr/local/lib/node_modules/n8n/src/push/index.ts:169:9)
at ExecutionLifecycleHooks.<anonymous> (/usr/local/lib/node_modules/n8n/src/execution-lifecycle/execution-lifecycle-hooks.ts:149:17)
Key Details:
Dataset Size: Processing ~1159 items per execution
n8n Version: 1.98.2
Setup: Docker deployment with Queue mode + Redis + 2 workers
Workflow Status: Actually succeeds ("Worker finished execution successfully"), but marked as failed due to Push error
What I've Tried
Configuration Attempts:
bash# Push Backend Settings
N8N_PUSH_BACKEND=none # Tried both none and websocket
N8N_DISABLE_LIFECYCLE_HOOKS=true # Attempted to disable hooks
N8N_DISABLE_UI=true # On workers only
# Execution Data Settings
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none # Tried to minimize data storage
EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
EXECUTIONS_DATA_COMPRESS=true
# Memory Settings
NODE_OPTIONS=--max-old-space-size=40960 # Main container
NODE_OPTIONS=--max-old-space-size=61440 # Workers
N8N_PAYLOAD_SIZE_MAX=26843545600
Architecture:
Main container: UI + Queue management
2 Worker containers: Processing only with N8N_PUSH_BACKEND=none
Redis queue with increased timeouts
PostgreSQL database
Root Cause Analysis
The issue appears to be a JavaScript engine limitation rather than an n8n configuration problem:
JSON.stringify() Limit: JavaScript has a maximum string length of ~268MB
Large Execution Data: When processing 1159 items, the serialized execution data exceeds this limit
Push Mechanism: n8n tries to serialize the entire execution result for frontend updates, hitting the string length limit
Lifecycle Hook Issue: Despite N8N_DISABLE_LIFECYCLE_HOOKS=true, the hooks still execute and attempt serialization
The Paradox
✅ Workflow Logic: Completes successfully, all API calls work, data is processed
✅ Worker Logs: "Worker finished execution successfully"
❌ UI Status: Shows as "Failed" due to Push.relayViaPubSub error
❌ Queue Management: Job gets marked as failed, triggering retries
Questions for the Community
Is there a way to completely disable the Push mechanism that bypasses lifecycle hooks entirely?
Can execution data serialization be made optional for large workflows where UI updates aren't critical?
Are there plans to implement streaming serialization for large execution data instead of single JSON.stringify calls?
Has anyone found a configuration that prevents this specific lifecycle hook from executing on large datasets?
Workaround Needed
I'm willing to accept:
No real-time UI updates during execution
Manual status checking via page refresh
Minimal execution data storage
But I need the execution to be marked as "successful" when it actually succeeds, not failed due to UI update serialization issues.
Technical Environment
Docker Compose setup
Queue mode with Redis
PostgreSQL database
2 dedicated worker containers
48GB Redis max memory
Processing workflows with 1000+ items regularly
Any insights, alternative configurations, or workarounds would be greatly appreciated! This seems to be a fundamental limitation where workflow success is being overshadowed by UI update failures.
3
0 comments
Mikail Akcocuk
3
N8N: RangeError: Invalid string length in Push.relayViaPubSub - Workflow succeeds but shows as failed
AI Automation Society
skool.com/ai-automation-society
A community built to master no-code AI automations. Join to learn, discuss, and build the systems that will shape the future of work.
Leaderboard (30-day)
Powered by