The Problem
I’m building a sub-workflow that wraps some RESTful API calls and at the end either returns a successful response or uses Stop and Error to throw the error to the parent workflow.
I’d like the parent workflow to be able to further handle the error, however all my attempts to pass an object using Error Type: Error Object have failed. It seems like this ‘object’ is always getting stringified which differs from my experiences with most other nodes. I have a strong suspicion this is a bug.
What I’m seeing
To illustrate the issue, here are several attempts to use the Stop and Error node along with the output received by the parent workflow node.
When using Error Type: Error Message, the parent receives an ‘error’ value with the message string. This is as I’d expect.
I can also use an expression along with Error Type: Error Message to populate the message or stringify the json. The behavior here also feels correct.
Now if I switch to Error Type: Error Object, my expectation would be that rather than ”error”: “message” I’d receive output along the lines of ”error”: {…}. Here’s a very simple example, a string is a JSON object so:
Error Object: ”An Error has occurred.”
Expectation: ”error”: “An Error has occurred”
Reality: ”error”: “Error: \”An Error has occurred.\”” - an escaped JSON string, prefixed by an “Error:” string.
I can’t even construct my own simple JSON error object:
Error Object: { "myMessage": "An Error has occurred." }
Expectation: “error": { "myMessage": "An Error has occurred." }
Reality: ”error": "Error: {\"myMessage\":\"An Error has occurred.\"}" - again, stringified JSON formatted into an “Error:” message string.
It gets even worse when I try to use expressions within the Error Object. Any attempts to use or return javascript objects without stringifying them myself results in an error within the node.
Now, when Stop and Error is hit, it throws up a little toast notification with the error message stringified. That makes sense, but I’m wondering if maybe that stringified value is what’s getting passed onward instead of the actual intended Error Object? Or maybe I’m just doing something horribly wrong.
There does seem to be at least one other person who’s run into this: How does Error Objects works? - #3 by Wouter_Nigrini
At the end of the day, I realize i could probably serialize the JSON into the message and re-parse on the other side, but that feels hacky and if this is indeed a bug I’d like to see it get fixed.
The Workflows
This issue is really just with the Stop and Error node itself
For context, if it helps, here is the overall workflow concept I’m trying to build. Please note that I’ve made other notes/suggestions in there which I’ll probably start another thread for, but are outside the scope of this issue.
Information on your n8n setup
- n8n version: 2.4.8
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): own,main
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu












