# Nodered crashing when using the node-red-contrib-cast node

**URL:** <https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550>\
**Category:** General\
**Created:** [17 August 2022 10:45 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550 "2022-08-17T10:45:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaamoeder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aaamoeder/32/66361_2.png) [@aaamoeder](https://discourse.nodered.org/u/aaamoeder)\
**Post date:** [17 August 2022 10:45 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/1 "2022-08-17T10:45:49Z")

</div>

I'm using this node to play audio on some of my cast enabled devices and although it functions, each time the node is called, node-red crashes with an error mentioning the node.error call telling me it's not a function ?

```auto
[error] TypeError: node.error is not a function
at errorHandler (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:52:10)
at getSpeechUrl (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:192:9)
at Timeout._onTimeout (/opt/node_modules/node-red-contrib-cast/cast-to-client.js:836:33)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7)
[11:33:11] WARNING: Node-RED crashed, halting add-on
[11:33:11] INFO: Node-RED stoped, restarting...
s6-rc: info: service legacy-services: stopping
[11:33:11] INFO: Node-RED stoped, restarting...
s6-svwait: fatal: supervisor died

```

running nodered as an HA add-on if it makes any difference  
V3.0.2 (latest available version under HA)

by commenting out some of the affected lines it works without crashing but this shouldn't happen.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 August 2022 11:41 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/2 "2022-08-17T11:41:27Z")

</div>

That is a known problem with that node (see ["cast" node crashing Node Red · Issue #337 · Hypnos3/node-red-contrib-cast · GitHub](https://github.com/Hypnos3/node-red-contrib-cast/issues/337))  
it is reported that switching to [node-red-contrib-castv2 (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-castv2) eliminates the issue.

---

<div class="post-metadata">

**Author:** ![aaamoeder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aaamoeder/32/66361_2.png) [@aaamoeder](https://discourse.nodered.org/u/aaamoeder)\
**Post date:** [17 August 2022 11:54 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/3 "2022-08-17T11:54:11Z")

</div>

I saw that post but the castV2 node is not nearly as user friendly as the cast node so I just wanted to let the NR team know that calling a valid function (node.error) seems to cause a full NR crash, so that perhaps some bug could be identified / fixed

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 August 2022 12:25 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/4 "2022-08-17T12:25:50Z")

</div>

It is a bug in the nodes code, not a issue with Node-RED. The author of the node is the one who needs to fix the problem, but the node hasn't been updated in two years.

You have a couple choices

1. add an issue to the node and hope the author will fix it
2. fork the node and fix it yourself
3. find another node to use

---

<div class="post-metadata">

**Author:** ![aaamoeder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aaamoeder/32/66361_2.png) [@aaamoeder](https://discourse.nodered.org/u/aaamoeder)\
**Post date:** [17 August 2022 12:40 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/5 "2022-08-17T12:40:23Z")

</div>

I understand the issue originates from the node's code, but surely that shouldn't result in a fatal crash of NR ? that's the point I'm trying to make.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 August 2022 12:47 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/6 "2022-08-17T12:47:52Z")

</div>

And the fix is for the author of the node to correct their bug. Their program is crashing causing NR to crash

---

<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:** [17 August 2022 12:53 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/7 "2022-08-17T12:53:55Z")

</div>

> [@aaamoeder](#):
>
> surely that shouldn't result in a fatal crash of NR

If a node generates an uncaught exception then the only safe thing for node-red to do is to shutdown. It may indicate a catastrophic failure of some sort in the system and any other action by node-red might make things worse.

---

<div class="post-metadata">

**Author:** ![aaamoeder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aaamoeder/32/66361_2.png) [@aaamoeder](https://discourse.nodered.org/u/aaamoeder)\
**Post date:** [17 August 2022 12:57 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/8 "2022-08-17T12:57:10Z")

</div>

OK, that makes sense.

I hope that by simply commenting out the lines the log mentioned I'm not going to mess up anything else.  
As far as a fix, this is as far as my knowledge goes to be honest, but at least it seems to be working at the moment. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 October 2022 12:57 UTC](https://discourse.nodered.org/t/nodered-crashing-when-using-the-node-red-contrib-cast-node/66550/9 "2022-10-16T12:57:23Z")

</div>

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