Stop and error broken?


I tried “Stop And Error” in both the docker and manual install and I have the same behaver on both. When trying to use Stop And Error, I get the following error in the node.

NodeOperationError: An error as occured!
    at Object.execute (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/StopAndError/StopAndError.node.ts:101:9)
    at Workflow.runNode (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1332:31)
    at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1046:44
    at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1722:11

Even the node alone, not linked to anything, return the same error in the output. Am I missing something ? The node seems pretty straightforward to me.

Hey @mike99,

It appears to be working for me, What version of n8n are you using and can you share a workflow that reproduces the issue?

Finally, I figured out it’s just not what I expected. That it’s use to make the workflow fail on purpose while I wanted to return an error to a webhook. Still, the Details section output really seems to contain an error.

I tried version is 1.27.2 and I just upgraded to 1.29.1 to make sure.

And if I look at the Details section on the output:

NodeOperationError: bar not foo
   at Object.execute (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/StopAndError/StopAndError.node.ts:101:9)
   at Workflow.runNode (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1374:31)
   at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1049:44
   at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1725:11

@mike99 When you want to return errors to a webhook you use the “Respond to webhook” node and set a custom status code. You need set the webhook trigger to respond with the “Respond to webhook” node before it works.

The status code for bad request from the client (sender of webhook) is 400 and for error in the workflow is 500. You can see a list of http error code meanings here.

When I make callable API style workflows I typically make them callable from http and other workflows directly, so i use both respond to webhook and stop and error so I can always handle errors “on the other side”

I also like to use a code node to make an array of input parameter errors to return. It makes it much easier to trouble shoot when you know what fields have errors. You can see an actual implementation of that in my workflow here.

I also return a schema with parameter fail errors. That is also in the workflow i linked above.

Hope that helps!

1 Like

Thanks a lot Liam, this is really appreciated.

I know that I had to answer with a 400 errors but was looking a way to do it and seems like I didn’t dig enough the Respond to webhook node. I will give it a try.

Thanks again, really appreciated.

You’re very welcome!

Another thing I forgot to mention, a great thing about the stop and error node is that you can try it again in the execution.
So if you send any 500 errors back its nice to have a stop and error too so you can rerun the failed node after making fixes!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.