Troubleshooting
Node-RED Catch node silent on a PLC error: which fix works
Short answer
A Node-RED Catch node fires only when a node reports the fault through the runtime error API. A debug line such as Failure (Bad values) is a log entry, not a catchable error. The fix is a scoped Status node or a data-freshness watchdog keyed to the poll interval, feeding a shaped payload to the database.

On this page
- Why doesn't the Catch node fire when the PLC read fails?
- How do I test which of the four signals the node actually sends?
- What does a Status node deliver when the link drops?
- How do I set a freshness watchdog when neither branch moves?
- How do I turn the caught fault into a database write?
- What if the node reports nothing catchable at all?
- Which fix do I use for my test result?
- Questions asked
A Catch node cannot catch what a PLC node never reports as an error. Failure (Bad values) in the debug sidebar is a log entry, not a fault sent through Node-RED's runtime error API, so no amount of Catch nodes will ever see it. You have three working paths from here: a scoped Status node if the read node changes its status when the link drops, a data-freshness watchdog keyed to the poll interval if it does not, or a maintained driver that reports errors properly. Run one controlled power-down with a Catch node and a Status node both watching the read node — the branch that moves tells you which path you are on. Below: the test, the watchdog arithmetic, the payload shape for the database write, and the decision for each test result.
Why doesn't the Catch node fire when the PLC read fails? #
Because a Catch node receives only errors a node sends through the runtime error API — the node.error(err, msg) call inside the node's code — and your PLC node writes Failure (Bad values) to the debug sidebar as a log line instead, so nothing ever reaches the Catch node.
Node-RED keeps log entries and catchable errors on two separate channels, and a message delivered to one never appears on the other. Reporting through the error API is code inside the node, not an editor setting, so you cannot promote a log line into a catchable error from the flow editor. When a read fails, one of four things happens, and only the last of them is catchable:
- A log line in the debug sidebar — visibility only; no message on any wire.
- A node status change, the text shown under the node, which the runtime publishes to Status nodes.
- An output message, such as a null payload on a second output.
- A catchable error, delivered to every Catch node whose scope covers that node.
How do I test which of the four signals the node actually sends? #
Wire a scoped Catch node and a scoped Status node to two Debug nodes that show the complete message, confirm healthy reads first, then power the PLC down once under controlled conditions and record which branch moves — that branch is the only fault signal this node gives you.
- Set the Catch node's scope to the PLC read node only and wire it to a Debug node showing the complete message object.
- Scope a Status node to the same node and wire it to a second full-message Debug node; let the healthy-state events through too, so you can tell failure states apart from them.
- Stop anything that depends on the controller, then cut its power or pull the link. One outage is enough. Run this on an idle machine or a bench rig — never drop a controller that active equipment is waiting on.
- Watch both Debug panes and the runtime log while
Failure (Bad values)appears. - Restore power and record recovery: what status the node settles into and whether fresh reads resume.
If the Catch branch stays silent and the Status branch moves, the Status node is your answer. If both stay silent, the node hands the flow nothing and you go to the watchdog. A silent Catch branch only proves something after this test, and check the scope before believing the silence: a Catch node scoped to the wrong node stays quiet forever.
What does a Status node deliver when the link drops? #
A Status node scoped to the PLC read node turns every status change that node publishes into a flow message, so the disconnect text you currently only see under the node arrives on a wire and you can build the database event from the status fields the message carries.
The Status node exists for exactly this: it catches any node's status updates, connect and disconnect messages included, and triggers other flows from them. Match the exact failure text your test captured — filter on the recorded string, not a remembered one, because a filter a single word off drops every outage silently and leaves your database convinced the link is healthy. Suppress the healthy-state events in the same branch, and pass recovery through separately so the database sees both edges of the outage.
How do I set a freshness watchdog when neither branch moves? #
Reset a timer on every completed PLC read and alarm when nothing completes for three times the measured poll interval — a flow polling every 5 s gets a 15-second timeout, which rides through two missed cycles yet still alarms in time to matter.
Worked example, using measured numbers from your own flow: the read node completes one read every 5 s. Timeout = 3 × 5 s = 15 s. Two missed polls span 2 × 5 s = 10 s, under the limit, so a single lost frame or one slow cycle cannot false-alarm; the third missed cycle takes the silence past the limit and the watchdog fires. The rule scales with your flow: a 1 s poll gives a 3-second timeout, a 30 s poll gives 90 s. Measure the interval from real timestamps between completed reads, not from the configured rate — retry logic inside a driver stretches the effective interval, and if your driver tries three times per failure, the effective interval and the timeout both triple.
Reset the watchdog only on a timestamp taken from a completed read. A failed read, a cached value or a status event must not refresh it, or the timer never runs out. Implement it with whatever timing nodes you prefer: the pattern is a timer each completed read resets, which emits the alarm when it expires.
This design needs periodic reads. A flow that publishes only changed values cannot use it, because an unchanged process value and a dead link look identical in silence — give such a flow a heartbeat read of a known value, or use the Status branch instead. And if you scale the pattern across many devices on one host, keep the polling load realistic, as in Polling 100 Modbus TCP slave IDs from Node-RED without 100% CPU.
How do I turn the caught fault into a database write? #
Put a Change or Function node between the moving branch and your database node and build msg.payload yourself — the fault arrives in msg.error or in the status fields, and neither lands in the payload on its own.
Shape every event with four fields: which connection failed, the state (fault or recovery), the time, and the diagnostic text copied from msg.error or the status string. Write transition-only events — hold the previous state in flow context and emit only when it flips — so a PLC that stays off through a hundred failed polls produces one fault row, not a hundred; the repeated diagnostics belong in the runtime log, not the table.
Keep communication state apart from process values: a failed read marks the data stale or unavailable, and must never overwrite the last good measurement, which a chart would otherwise plot as a zero or keep displaying as if it were fresh. Write the recovery transition only after a fresh completed read, and test that path too, because reconnects can leave stale state behind — the pattern in why a Reading Tag Group timeout persists after a PLC reconnect, where the fault clears on the wire but the timeout survives it.
What if the node reports nothing catchable at all? #
Then the package is the fault, not your flow: a node that only logs its failures must be fixed in its code or replaced with one that reports through the error and status interfaces, and no editor-side wiring will change that.
node-red-contrib-ab sits in exactly that state: the package has not been updated in about two years and lists no repository where issues can be reported, so a code fix means reaching its author directly. It is an old fork of node-red-contrib-s7, which is more widely used and actively maintained — the natural candidate, but shared ancestry is not a compatibility certificate. Bench-test a replacement against your actual controller before any production write moves: addressing, data types, update behavior, failure behavior under a power-down using the same test from earlier, and clean recovery afterwards. Record the installed version of whichever package you deploy, because behavior like this is version-specific, and package history is no substitute for checking what actually runs. If you have to stay on the current package, the watchdog above is your permanent design, not a stopgap.
Which fix do I use for my test result? #
Use the branch that moved in your test: the Catch node if it fired, the Status node if only status moved, and the freshness watchdog if both stayed silent — and in every case, transition-only events, stale data marked unavailable, recovery confirmed by a fresh read.
- Catch node fired — keep one Catch node scoped to the read node, map
msg.errorintomsg.payload, and you are done. - Only the Status node moved — scope a Status node to the read node, filter on the exact captured failure text, and suppress the healthy events.
- Both silent — build the freshness watchdog with the timeout worked out above, add a heartbeat read if the flow publishes only changes, and log a driver fix or replacement as follow-up work.
- Every case — write one event per state transition, keep the last good process value untouched by failed reads, and arm the recovery write only on fresh data.
Questions asked
Does an error caught by a Catch node still show in the debug sidebar?
No. Once a Catch node receives an error, Node-RED drops the debug sidebar entry for that error, and the Catch node's output becomes the only place the message appears. This is why adding a wide-open test Catch node can make your debug pane suddenly quieter: the errors still flow, just on the Catch wire instead of the sidebar. Expect that effect during the scoped test and do not read it as a second fault.
Can one Catch node cover my whole flow?
Yes. A Catch node left without a scope restriction receives errors from every node on the same tab, while a scoped one receives only errors from the nodes on its list. One unscoped Catch works well when every failure goes to the same alarm flow; separate scoped nodes suit flows where different failures need different handling.
Can a Catch node catch errors thrown inside a Function node?
Yes. An error thrown in a Function node is reported through the same runtime error interface and reaches any Catch node covering that node, and the throw does not crash Node-RED itself. Asynchronous code is the exception to test deliberately: an error surfacing inside a callback after the Function node has finished behaves differently from a synchronous throw.
Is node-red-contrib-s7 a drop-in replacement for node-red-contrib-ab?
It is the more widely used, actively maintained package that node-red-contrib-ab was forked from, so it is the first candidate to test, but a fork relationship alone proves nothing about your application. Plan the swap the way you would any driver change: parallel flows on a bench controller, a controlled power-down test, and a rollback path that leaves the old flow intact until the new one has run a full shift.
