# Multiple inputs to save into a file! failed to write to file: Error: write after end

**URL:** <https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058>\
**Category:** General\
**Created:** [12 April 2019 09:08 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058 "2019-04-12T09:08:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xoani](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xoani/32/7844_2.png) [@xoani](https://discourse.nodered.org/u/xoani)\
**Post date:** [12 April 2019 09:08 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/1 "2019-04-12T09:08:38Z")

</div>

Hello, I am saving the output of a python script that I am running on node-RED into a local file. Because the output is too long (I am guessing), it comes in two message.payload right next to the other. I want to save them both into a local file and when I put a save file node after the python script , I get this error:

`failed to write to file: Error: write after end`

I am aware of this post [https://github.com/node-red/node-red/pull/1894](https://github.com/node-red/node-red/pull/1894) and I understand now what the problem is, but I don't know how to fix it. I don't understand how to download/implement the solution in this post. I can't find anything. Does anyone have a different solution or can tell me how to implement this one? Thanks.

---

<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:** [12 April 2019 09:14 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/2 "2019-04-12T09:14:26Z")

</div>

If you read that PR, you will see it was merged into the code in the v0.19.5 release of NR so if you are on v0.19.5 or later, this is already in the code.

When posting an issue it is helpful to provide

1. version on node-red
2. version of node.js
3. platform you are using and OS version (like Raspberry Pi running stretch lite)
4. a `simplified` copy of your flow demonstrating the issue.  
Doing this will save time for people who might decide to help you.

---

<div class="post-metadata">

**Author:** ![xoani](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xoani/32/7844_2.png) [@xoani](https://discourse.nodered.org/u/xoani)\
**Post date:** [12 April 2019 09:19 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/3 "2019-04-12T09:19:48Z")

</div>

Okay, thanks. I did read the PR but I do not understand these words. You are right, I have a version v0.19.4 . Is the only solution to install Node-RED from the start? I already have a big flow that is working. Am I gonna lose everything?

---

<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:** [12 April 2019 09:29 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/4 "2019-04-12T09:29:32Z")

</div>

You can upgrade Node-RED without losing any of your data.

How did you install node-red originally?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [12 April 2019 09:32 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/5 "2019-04-12T09:32:28Z")

</div>

But if you have a big flow you probably should be taking backups anyway.

It’s easy enough to copy the flow file to another location or to use the node-red projects feature.

---

<div class="post-metadata">

**Author:** ![xoani](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xoani/32/7844_2.png) [@xoani](https://discourse.nodered.org/u/xoani)\
**Post date:** [12 April 2019 09:35 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/6 "2019-04-12T09:35:42Z")

</div>

I just followed the documentation in the Raspberry Pi website to install Raspbian and Node-RED came with it if I remember correctly. I didn't have to install it separately.  
[https://www.raspberrypi.org/documentation/installation/installing-images/](https://www.raspberrypi.org/documentation/installation/installing-images/)

---

<div class="post-metadata">

**Author:** ![xoani](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xoani/32/7844_2.png) [@xoani](https://discourse.nodered.org/u/xoani)\
**Post date:** [12 April 2019 09:36 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/7 "2019-04-12T09:36:36Z")

</div>

Hello. That would be very helpful so that at least it's safe even if I mess something up while upgrading. How can I do that?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [12 April 2019 09:39 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/8 "2019-04-12T09:39:11Z")

</div>

Node-RED reports where the flows file is on startup. How to copy that to a new location? Copying a file is hopefully something you already know how to do.

The projects feature? See the docs on the node-red website.

---

<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:** [12 April 2019 09:47 UTC](https://discourse.nodered.org/t/multiple-inputs-to-save-into-a-file-failed-to-write-to-file-error-write-after-end/10058/9 "2019-04-12T09:47:36Z")

</div>

The Pi docs on [nodered.org](http://nodered.org) give you a script we provide to install/update NR.
