# Intercept Modbus errors

**URL:** <https://discourse.nodered.org/t/intercept-modbus-errors/101461>\
**Category:** Industrial\
**Created:** [12 July 2026 17:09 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461 "2026-07-12T17:09:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [12 July 2026 17:09 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/1 "2026-07-12T17:09:05Z")

</div>

Hello,

I am using the Modbus Write and Read functions.  
I have enabled logging and error reporting, which output to the Windows Command Prompt (cmd) console.

How can I intercept these messages directly at the function output, or retrieve them from the console?  
If a read or write error occurs, I want to set a variable to 1.

Thanks in advance for your help.

"12 Jul 18:57:13 - [error] [modbus-read:8eb259425571f342] Error: Timed out"

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 July 2026 17:47 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/2 "2026-07-12T17:47:04Z")

</div>

Does a Catch node catch the error?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [13 July 2026 09:28 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/3 "2026-07-13T09:28:40Z")

</div>

Hi,

Yes, but no details.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/eccd410666cd635e5aec69930e2681c486b69e8f.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 July 2026 09:32 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/4 "2026-07-13T09:32:49Z")

</div>

@jlt57 can you modify that Debug node to show the complete msg object? It is currently showing `msg.payload` - the Catch node will include error details under `msg.error`

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [13 July 2026 09:49 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/5 "2026-07-13T09:49:45Z")

</div>

Here (in the catch block), it intercepts the read error but not the write error, even though it is configured for all nodes.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be88e874757337789aeb8285e6559b18f6c9612a.png)

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [13 July 2026 09:52 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/6 "2026-07-13T09:52:09Z")

</div>

@knolleary Thanks a lot

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 July 2026 10:03 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/7 "2026-07-13T10:03:05Z")

</div>

> [@jlt57](#):
>
> t intercepts the read error but not the write error,

That is strange, is there an error in the log for the write error and does the modbus node show an error status?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [13 July 2026 11:14 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/8 "2026-07-13T11:14:31Z")

</div>

Actually, it seems like there's an error only for the first stream, not the subsequent ones.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/d/8d2de0f0f031299c5591a20fcfe63c75b0c193dd.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 July 2026 12:26 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/9 "2026-07-13T12:26:00Z")

</div>

> [@jlt57](#):
>
> it seems like there's an error only for the first stream, not the subsequent ones.

What do you mean by 'stream'?

When you say there are no errors on subsequent ones do you mean there are no errors, or there are errors but they are not reported, or do you mean something else?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [13 July 2026 12:49 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/10 "2026-07-13T12:49:41Z")

</div>

Yes, there are errors, but they aren't being reported.  
As shown in the screenshot, the "read (2)" block is polling (e.g., a disconnected cable error is detected by the `catch` node); however, if I inject a write command using the "1 xrite" node, no error is reported by the `catch` node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 July 2026 13:19 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/11 "2026-07-13T13:19:57Z")

</div>

> [@jlt57](#):
>
> if I inject a write command using the "1 xrite" node, no error is reported by the `catch` node.

Is an error logged?  
What status is shown under the node?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [14 July 2026 08:08 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/12 "2026-07-14T08:08:26Z")

</div>

Hi,  
Actually, when you have just a single read node or a single write node, the error is reported via the Catch node.  
If you have both a read and a write operation in the same tab, only the read error (the first error) is reported by the Catch node.  
Regarding why it's the read operation in my case: I think it's related to polling.

Continuing with my line of reasoning as to why only one event is reported by the Catch node:  
it's because both nodes point to the same connection node that links to the PLC.

It’s just something you need to be aware of.  
With PLCs, you can diagnose every command sent; that’s why I wanted to do the same thing with Node-RED.

Those are my deductions—still to be confirmed...

Sorry for my English.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 July 2026 08:24 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/13 "2026-07-14T08:24:20Z")

</div>

> [@jlt57](#):
>
> If you have both a read and a write operation in the same tab, only the read error (the first error) is reported by the Catch node.  
> Regarding why it's the read operation in my case: I think it's related to polling.

You would expect the read node to be the first one to generate an error as it tries regularly.

You didn't actually answer the questions. If (after the read error) you try to write, does it log another error (in the log) and what status is shown under the node?

If you disable the read node, so it does not generate an error, then with the modbus working correctly you disconnect and try another write do you then get an error from the write node?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [14 July 2026 08:32 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/14 "2026-07-14T08:32:06Z")

</div>

Sorry

You didn't actually answer the questions. If (after the read error) you try to write, does it log another error (in the log) and what status is shown under the node? --\> NO

If you disable the read node, so it does not generate an error, then with the modbus working correctly you disconnect and try another write do you then get an error from the write node? --\> YES

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 July 2026 08:38 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/15 "2026-07-14T08:38:22Z")

</div>

It would be more helpful if an error was thrown each time an operation is attempted I think. You could raise an issue on the node's github page and see if the author agrees.

You still didn't answer all of the question - what status is shown under the nodes when in error?

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [14 July 2026 08:42 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/16 "2026-07-14T08:42:40Z")

</div>

Reconnecting..

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fade8c14dedfb7105048379763f473d069ecbe5e.png)

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [14 July 2026 08:44 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/17 "2026-07-14T08:44:20Z")

</div>

I'm not used to this yet—where can I find the GitHub link?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 July 2026 08:59 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/18 "2026-07-14T08:59:24Z")

</div>

You might be best to use a Status node to give you the status, and use that to know whether there is a problem or if all is working.

Got to [flows.nodered.org](http://flows.nodered.org), find the node and there should be link to the GitHub page, on the right hand side I think. Or an internet search asking in words where to find it would likely work.

---

<div class="post-metadata">

**Author:** ![jlt57](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jlt57](https://discourse.nodered.org/u/jlt57)\
**Post date:** [14 July 2026 09:05 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/19 "2026-07-14T09:05:51Z")

</div>

Yes,  
With the node of status I Can have this ?  
How can errors from a PLC connection configuration node be retrieved?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b1cc4f236493d748aa0686d160e2fbe6cccfe0ad.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/dac2beb1fb606a857cec092d96ed23059c839313.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 July 2026 09:12 UTC](https://discourse.nodered.org/t/intercept-modbus-errors/101461/20 "2026-07-14T09:12:31Z")

</div>

It won't give you the error message, just the text displayed under the node.

[Next page](https://discourse.nodered.org/t/intercept-modbus-errors/101461.md?page=2)
