All my nodes and flows gone

Hi all
Has anyone one had a problem like this.
Node red been runni g on my rpi3 for few months no problem.
I had download about ten other nodes and i have two flows funning.
For some reason i lost conection to node red but the rpi3 Nd openhab still running.
I restarted the rpi3 as nodered setup to start on boot but it did not.
I had to start nodered from terminal. When it started i my nodes i had downloadex had gone and no flows were showing.
Any ideas as at the moment this is a test shstem but i want this to control a!l my home automtion.

Regards

Andy

I had a similar problem with my databank, there was the problem, that it was stored in volatile memory, but normally node Red is stored at the sd Card and also all the flows are…
But maybe you can check where your flows are stored…

How are you starting node red in the terminal?

Copy/paste here the contents of the terminal after the node red start.

Also copy/paste the result of
sudo systemctl status nodered

In case you don’t know you can copy out of a terminal using Ctrl+Shift+C

Thank you for your reply.

not letting me reply

What do you mean? What is not letting you reply?

each time i try to send what i have pasted it comes up

Sorry, new users can only put 2 links in a post.

@Andyk5 there are some limits to brand new users that go away after 24 hours - to discourage spam bots from flooding the forum.

But you have used up some of your replies by replying saying you can’t reply…

You can go back and edit your previous posts to provide more details.

One thing to be aware of is that Node-RED uses the hostname to generate the flow file name. If you changed your Pi’s hostname then it wouldn’t find your flow file anymore.

The flow files is stored in ~/.node-red/ and is called flows_<hostname>.json . Have a look in that directory for any JSON files with content.

3 Likes

You don’t need to use links, just paste the text in, assuming it is not huge.
After following knolleary’s advice that is.

Hi ALL

I will allow 24 hours it i can not edit or paste information.
thank you for your help with this.

Don't know, if you have ever solved this, but for others coming here for the same problem, I have just encountered the same issue.
Node-red running for months, and all of the sudden, the flows are gone.

Looking at the logs and configs, it quickly turned out I renamed my raspberry pi's hostname some weeks ago, and now Node-Red by opens a different default flow file (since the flow-file includes the hostname).

After renaming my existing flow-file in ~/.node-red to match my new hostname, everything was there again.

1 Like

I just encountered the same problem. Node-Red running fine for months and all flows gone all of a sudden.

A look in the ~/.node-red folder revealed that there is a new flow-file called "flow_hostname_cred" which is the empty one.

I switched Node-Red to HTTPS with LetsEncrypt a few weeks/months ago and it seems node-red decided to create a new Flow-File because of that - at least that's what the suffix "cred" is suggesting.

Not quite. The _cred file is your flow credentials file. It is a companion file to your actual flows file that has the matching name without the _cred part.

As you'll have noted, the flow file includes the hostname by default. Have you changed hostname whilst setting up letsEncrypt?

When NR starts, it logs the name of the exact flows file it will use. Check if that file exists, or for any other json files in ~/.node-red.

That "dynamic" naming of the flow file seems to be a common source of errors, especially for beginners.

It is the first thing I change in my workspaces by setting a fixed name (usually just flows.json). As a benefit, it also keeps the workspace portable.

@knolleary: Would it be possible to change this behavior to use a fixed name by default? That would eliminate these issues in the first place.

You could enable the flowFile: 'flows.json' setting in the settings.js template for new workspaces to keep compatibility.

Out of curiosity, what was the reason behind including the hostname in the first place?

The original idea/reason was back in the day, when i had about 20 devices in a field I could create a bunch of flow files, one per machine, and keep them all in the same .node-re directory... so I could then flash the same set of files to every machine before deployment (ie one master image). When the machine booted up it used its hostname name to pick its own flow file so they all ran their correct code. And likewise I could just walk round and back them all up to the same stick using an auto-insert script to copy the flow file (and data logs) into a directory on the stick. Works great if you use fixed hostnames.

Thanks for clarifying. :slightly_smiling_face:

That was back in the day.
Now the question is: Is this assumption still valid for more recent use-cases and the majority of users today? :face_with_monocle:

It wasn't an assumption - it was a decision :slight_smile:

If we do change it - it needs to be in a way that doesn't break all existing users...

That can be achieved by just changing the settings.js template that gets copied over to new workspaces, no code changes required. Just uncomment flowFile: 'flows.json' by default.

That will take effect only for new workspaces, and keep the existing ones untouched, as the settings.js is already there (and possibly customized).

You are right. That explains why replacing the *cred file with the actual Flow-file didn't do anything.

I got it working again by simply opening the flow file from my /.node-red folder and import it into node-red again. I checked where it stores the file: found it in node-red and it was called "start".

It seems because I started node-red from SSH via "node-red start" it created a new flow file called like that. Didn't knew that behavior and was pretty sure I already started NR like this, but well it seems the issue was self-created.

node-red start is a command to run node-red using a flow file called start. You probably meant to use node-red-start.