HTTP node will not yield error data when continuing execution on error

Describe the problem/error/question

The HTTP node, configured with the “Always Output Data” and “Continue” on error, will not output error data or an empty object to the next node when a node error occurrs (ie. “ERROR: JSON parameter need to be an valid JSON”).

Instead, it will output the JSON data the HTTP node received as an input.

What is the error message (if any)?

No specific error is displayed.

Please share your workflow

In the workflow below I purposely trigger a JSON error on the HTTP request node. What will arrive on the If node will be the data set on the first node.

Information on your n8n setup

  • n8n version: 1.25.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 22.04

@groman , you have HTTP Request node misconfigured. You are trying to send JSON body with GET request, which causes misbehavior. Perhaps you pasted different workflow, not the one you want to demonstrate the problem?

As stated in my original post, I am purposely triggering a JSON error in the node for the bug to show. Configuring the node to use GET or POST is not relevant to the issue, as the result yielded to the next node will be erroneous just the same - the original JSON passed to the HTTP node instead of the error object.

Hey @groman,

This is likely because of the type of error, The error we forward is the error from the request itself rather than what we call a NodeOperationError.

Maybe this is something we should look at changing in the future as I can see why this would be useful.

Hello Jon,

Thank you for your answer. This however means that, if the node receives an invalid JSON (which is sometimes dependent on external systems) and there is no way to detect and treat this error - is that right?

As an example - I set my HTTP node to always output data and continue on error, so I can treat the error and return a message to the workflow caller. If the error is due to HTTP (ie. file not found), the node will continue and the error will be correctly yielded to the next node. However, if the error is due to a JSON formatting error, it will cause the node to continue as well, but with no error yielded, but rather the JSON it had received as an input (arguably this is an unexpected behaviour).

In that case, the following If node has no means to know there has been an error at all - except for maybe comparing the data passed by the HTTP node with the data the HTTP node received as an input. Which on the other hand can lead to confusion, as some nodes will not change their output during operation.

Additionally, as the node will always continue on error, there is also no way to handle node operations errors using a fallback error workflow.

Please do let me know if I’m wrong. I am very enthusiastic about the platform and really appreciate all your work. Thank you!

Additionally - this behaviour does not seem to happen in other nodes. Please find below a workflow that puts an invalid JSON on both an HTTP node (“ERROR: JSON parameter need to be an valid JSON”) and a Slack node (“ERROR: Custom Values must be a valid JSON”). The Slack node will yield an error object, rather than its input.

Finally (and apologies for the fragmented post), I can confirm the behaviour was different past versions. I just tested the above in an old n8n installation with version 1.8.2. When failing with the JSON error, the HTTP node yielded an empty object - which is still not ideal, but makes more sense than returning the node input.

Hey @groman,

The HTTP Request node works in a slightly different way to other nodes and we will need to tweak the handling on it so it falls in line. There will be a couple of other nodes that likely do the same thing as well.

1 Like

Good afternoon Jon,

Apologies for the late reply - thank you for acknowledging that. Hopefully we can get all nodes to behave the same way on errors at some point?

Thank you and kind regards.

1 Like

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