# Error \[ERR\_STREAM\_DESTROYED\]

**URL:** <https://discourse.nodered.org/t/error-err-stream-destroyed/37276>\
**Category:** General\
**Created:** [9 December 2020 22:07 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276 "2020-12-09T22:07:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davenrea](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/davenrea/32/32842_2.png) [@davenrea](https://discourse.nodered.org/u/davenrea)\
**Post date:** [9 December 2020 22:07 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/1 "2020-12-09T22:07:33Z")

</div>

I get the following error occasionally which I need to trap and issue something like “sudo systemctl restart nodered” to restart node-red automatically. Please share if you know how!!

Error connecting to dbus: Error [ERR\_STREAM\_DESTROYED]: Cannot call write after a stream was destroyed

Thanks

Dave

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 December 2020 22:33 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/2 "2020-12-09T22:33:46Z")

</div>

Hi.

Can i assume node-red is being crashed and the error in the log is `ERR_STREAM_DESTROYED`?

If so, you should identify the node causing this and report that as an issue on the nodes repository (in short, something is possibly not handing errors correctly & can probably be fixed to _ **not** _ crash node-red)

As for restarting node-red service - surely you just need to setup [auto restart](https://ma.ttias.be/auto-restart-crashed-service-systemd/)?

---

<div class="post-metadata">

**Author:** ![davenrea](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/davenrea/32/32842_2.png) [@davenrea](https://discourse.nodered.org/u/davenrea)\
**Post date:** [10 December 2020 06:20 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/3 "2020-12-10T06:20:31Z")

</div>

Steve

Yes, that is correct. I have identified the node where it is caused but getting no response from an earlier issue. As a VERY new user to this sort of thing (node-red is the limit of any "programming" I have done) the auto restart is the sort of thing I need but not sure how to add it to node-red.

cheers

Dave

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 December 2020 07:24 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/4 "2020-12-10T07:24:57Z")

</div>

> [@davenrea](#):
>
> I have identified the node

What is the full name of this node?

> [@davenrea](#):
>
> the auto restart is the sort of thing I need but not sure how to add it to node-red.

If node-red is crashing, it cannot restart itself.  
However if you mean you are trying to get node-red to setup auto restart, then you wouldn't do that either. It is systemctl itself that takes care of auto restarting a failed service.  
Re-read that link I provided in my first response or search the internet for "systemctl auto restart failed service"

---

<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:** [10 December 2020 07:42 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/5 "2020-12-10T07:42:28Z")

</div>

What OS are you running and how did you install node red?

---

<div class="post-metadata">

**Author:** ![davenrea](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/davenrea/32/32842_2.png) [@davenrea](https://discourse.nodered.org/u/davenrea)\
**Post date:** [10 December 2020 11:25 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/6 "2020-12-10T11:25:00Z")

</div>

the node is @victronenergy/node-red-contrib-victron.

i'm not sure if it is node red crashing or just stopping as the erroer i get is just displayed as "Error connecting to dbus: Error [ERR\_STREAM\_DESTROYED]: Cannot call write after a stream was destroyed". What i am trying to replicate is the manual action of typing node-red-stop and node-red-start in a terminal window when it happens, a big issue being I dont know it has happened until i look

thanks

dave

---

<div class="post-metadata">

**Author:** ![davenrea](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/davenrea/32/32842_2.png) [@davenrea](https://discourse.nodered.org/u/davenrea)\
**Post date:** [10 December 2020 11:26 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/7 "2020-12-10T11:26:40Z")

</div>

Colin, it is running rasbian on a Pi and i installed the node through manage palette option

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 December 2020 11:39 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/8 "2020-12-10T11:39:17Z")

</div>

> [@davenrea](#):
>
> Error [ERR\_STREAM\_DESTROYED]

Seems the developers are aware of [this issue](https://github.com/victronenergy/node-red-contrib-victron/issues/45). Seems to me they are not so interested in fixing it as they dont see this problem on thier own OS! I would (if I were you) post a follow up reply in that issue stating you too are having the issue - just to let the developer know the issue still exists & is probably affecting more people than they realise (they may not be aware of how common this is as people tend not to bother reporting issues and generate workarounds - much like yourself)

In the mean time, there are several threads on this forum related to restarting node-red  
[this one](https://discourse.nodered.org/t/restart-flows-using-node-red-api/34632) _MIGHT_ work for you (it restarts your flows via the API - import the last flow under "solution 2" in that link)

---

<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:** [8 February 2021 11:39 UTC](https://discourse.nodered.org/t/error-err-stream-destroyed/37276/9 "2021-02-08T11:39:19Z")

</div>

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