# Unable to use write file note on RBpi

**URL:** <https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214>\
**Category:** General\
**Created:** [18 November 2024 06:11 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214 "2024-11-18T06:11:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [18 November 2024 06:11 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/1 "2024-11-18T06:11:58Z")

</div>

Likely new user error, but I haven't yet been able to find an answer yet. I used the recommended install script on a Rasberry Pi 4 and I have had no luck creating the a file with the "write file" node.

I have tried /home/XXX/event.log, ~/event.log, event.log  
to no avail.

In each case I have done a full filesystem search for event.log with no results. I can see that data is coming into the node with the debug

If found that if I put a debug node after the write-file node, nothing is logged, if I "fork" the input to both the write to file and to a separate debug node, the parallel debug not logs but not the one following the write-file node.

I have several questions:

1. Any ideas why this isn't working?
2. Is there any logging were I could see a "node failed" info/error message? It can find a log with journalctl -u nodered.service but don't see any pertinent info to a failing node process.  
Along these lines, maybe there is a pointer to a good set of debug strategies?

Thanks!

---

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [18 November 2024 06:50 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/2 "2024-11-18T06:50:35Z")

</div>

Update: I added a catch all node with debug output, and get nothing on it.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [18 November 2024 07:43 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/3 "2024-11-18T07:43:37Z")

</div>

What exactly are you writing to the file ?

> write file

> Writes `msg.payload` to a file, either adding to the end or replacing the existing content. Alternatively, it can delete the file.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 November 2024 09:59 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/4 "2024-11-18T09:59:12Z")

</div>

Are you accessing Node-red as localhost:1880 with a browser on the Pi, or from another device?

Are you passing msg.filename into the write-file node?  
Please show us a screenshot of the node's config.

> [@badgie](#):
>
> If found that if I put a debug node after the write-file node, nothing is logged

Check your wiring by moving the node around a little. It is possible to have a node laying on top of a wire but not actually connected.

---

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [18 November 2024 17:24 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/5 "2024-11-18T17:24:20Z")

</div>

I am running this on a headless RBpi, connecting in via [http://redalert.local:1880](http://redalert.local:1880)

I have confirmed that the nodes are in fact connected by moving as suggested.

Attached is an instance with just a relative path in the configuration, among the others I have tried.

I only get debug output from Debug 1

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

(and I did take that screen cap before I deployed!)  
I should also add I've tried with and without the create directory box checked.

---

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [18 November 2024 17:28 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/6 "2024-11-18T17:28:53Z")

</div>

I am logging outputs from my hubitat. This is a temporary step as I am want to setup a logging database and I am trying to get a feel for all message types that my system will be generating, so I am planning to dump for ~24 hours then find all unique message types. I am doing some work on the house soon and I would like to, for example see how it impact the cycle rate of my HVAC system.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 November 2024 17:35 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/7 "2024-11-18T17:35:45Z")

</div>

> [@badgie](#):
>
> I am running this on a headless RBpi, connecting in via [http://redalert.local:1880](http://redalert.local:1880)

Presumably you are looking for event.log on the Pi not on the browser machine.

Since you say you installed with the standard script, I don't see any explanation for seeing neither the debug output nor an error message.  
Try restarting Node-red, rebooting the Pi, clearing the browser cache and finally reinstalling Node-red.  
If you have already done a lot of work, take a backup first, though the install script does not usually result in lost data.

---

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [18 November 2024 17:58 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/8 "2024-11-18T17:58:44Z")

</div>

Ok, so I found the problem(s). (After trying all your steps of course, but they were easy and nothing was lost)

All new user errors.  
1: apparently Debug 1 was complete message and Debug 3 was msg.payload  
2: The hubitat connection messages don't seem to contain a payload!

The debug that cracked the nut for me was "let's try the stupidest possible chain"  
inject timestamp -\> write -\> debug

And of course this worked immediately, and I then noticed that the debug output there explicitly contained "payload" which was missing from the other debug outputs.

Thank you for your help. Could you point me to how to move the object from the "websocket in" into a msg.payload?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [19 November 2024 07:40 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/9 "2024-11-19T07:40:58Z")

</div>

Make sure [to go through the documentation](https://nodered.org/docs/user-guide/messages).  
The message concepts are at the core of node-red.

---

<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:** [19 November 2024 08:22 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/10 "2024-11-19T08:22:38Z")

</div>

Also I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![badgie](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@badgie](https://discourse.nodered.org/u/badgie)\
**Post date:** [19 November 2024 19:36 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/11 "2024-11-19T19:36:07Z")

</div>

Thanks, I think it's a good time to re-watch those videos. I suspect a lot of the issues I ran into were in the tutorials but I didn't quite internalize the implications and how they would impact flows. I'm still building my mental model of the system. I appreciate all the pointers and help trying to figure out these kind of beginner issues!

---

<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:** [17 February 2025 19:36 UTC](https://discourse.nodered.org/t/unable-to-use-write-file-note-on-rbpi/93214/12 "2025-02-17T19:36:58Z")

</div>

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