# Node-red dashboard "refused to connect"

**URL:** <https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [24 May 2024 08:50 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224 "2024-05-24T08:50:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [24 May 2024 08:50 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/1 "2024-05-24T08:50:29Z")

</div>

I am having a problem with my node-red. I am running node-red on a windows 10 PC and using node-red-dashboard as UI. The problem is that sometimes when I get power outage, the node-red stops working. In the browser it says "refused to connect", to the adress 128.1.11.3:1880/ui/.  
How I solve the problem:  
I delete the context folder in the node-red folder.  
Then I restart the PC and starting node-red.

What could cause this problem?  
How should I locate the problem so I can get rid of this?

---

<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:** [24 May 2024 09:05 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/2 "2024-05-24T09:05:39Z")

</div>

Welcome to the forum @larro96

Is node-red running? Can you connect to the editor at 128.1.11.3:1880?

> [@larro96](#):
>
> I delete the context folder in the node-red folder.  
> Then I restart the PC and starting node-red.

Does that fix it? If not show us what you see in the command window when you start node-red.

If that does fix it, does just restarting node-red fix it (without clearing the context)? If not then, again, show us what you get in the command window when you restart node-red.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [24 May 2024 09:34 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/3 "2024-05-24T09:34:09Z")

</div>

Node-red is running and I can connect to the editor.

My solution is solving the problem, just restarting node-red doesn't.  
I'll get some screenshots next time it crashes.

---

<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:** [24 May 2024 09:49 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/4 "2024-05-24T09:49:10Z")

</div>

> [@larro96](#):
>
> I'll get some screenshots next time it crashes.

No, copy/paste the output please.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [27 May 2024 05:06 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/5 "2024-05-27T05:06:12Z")

</div>

Here is the output:  
Your environment has been set up for using Node.js 18.15.0 (x64) and npm.

```auto
C:\Users\Pc>node-red
27 May 06:33:35 - [info]

Welcome to Node-RED
===================

27 May 06:33:35 - [info] Node-RED version: v3.0.2
27 May 06:33:35 - [info] Node.js version: v18.15.0
27 May 06:33:35 - [info] Windows_NT 10.0.19045 x64 LE
27 May 06:33:38 - [info] Loading palette nodes
27 May 06:33:44 - [info] Dashboard version 3.4.0 started at /ui
27 May 06:33:44 - [info] Settings file : C:\Users\Pc\.node-red\settings.js
27 May 06:33:44 - [info] Context store : 'default' [module=localfilesystem]
27 May 06:33:44 - [error] Failed to start server:
27 May 06:33:44 - [error] Error: Error loading context store: Error: Invalid JSON in context file '\Users\Pc\.node-red\context\b1531b115956bc02\dcea7f832804799a.json'
    at C:\Users\Pc\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\context\index.js:180:15

C:\Users\Pc>node-red
27 May 06:36:12 - [info]

Welcome to Node-RED
===================

27 May 06:36:12 - [info] Node-RED version: v3.0.2
27 May 06:36:12 - [info] Node.js version: v18.15.0
27 May 06:36:12 - [info] Windows_NT 10.0.19045 x64 LE
27 May 06:36:15 - [info] Loading palette nodes
27 May 06:36:20 - [info] Dashboard version 3.4.0 started at /ui
27 May 06:36:20 - [info] Settings file : C:\Users\Pc\.node-red\settings.js
27 May 06:36:20 - [info] Context store : 'default' [module=localfilesystem]
27 May 06:36:20 - [error] Failed to start server:
27 May 06:36:20 - [error] Error: Error loading context store: Error: Invalid JSON in context file '\Users\Pc\.node-red\context\b1531b115956bc02\dcea7f832804799a.json'
    at C:\Users\Pc\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\context\index.js:180:15

C:\Users\Pc>node-red
27 May 06:41:40 - [info]

Welcome to Node-RED
===================

27 May 06:41:40 - [info] Node-RED version: v3.0.2
27 May 06:41:40 - [info] Node.js version: v18.15.0
27 May 06:41:40 - [info] Windows_NT 10.0.19045 x64 LE
27 May 06:41:43 - [info] Loading palette nodes
27 May 06:41:49 - [info] Dashboard version 3.4.0 started at /ui
27 May 06:41:49 - [info] Settings file : C:\Users\Pc\.node-red\settings.js
27 May 06:41:49 - [info] Context store : 'default' [module=localfilesystem]
27 May 06:41:49 - [error] Failed to start server:
27 May 06:41:49 - [error] Error: Error loading context store: Error: Invalid JSON in context file '\Users\Pc\.node-red\context\backup 240527\dcea7f832804799a.json'
    at C:\Users\Pc\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\context\index.js:180:15

C:\Users\Pc>node-red
27 May 06:42:10 - [info]

Welcome to Node-RED
===================

27 May 06:42:10 - [info] Node-RED version: v3.0.2
27 May 06:42:10 - [info] Node.js version: v18.15.0
27 May 06:42:10 - [info] Windows_NT 10.0.19045 x64 LE
27 May 06:42:12 - [info] Loading palette nodes
27 May 06:42:18 - [info] Dashboard version 3.4.0 started at /ui
27 May 06:42:18 - [info] Settings file : C:\Users\Pc\.node-red\settings.js
27 May 06:42:18 - [info] Context store : 'default' [module=localfilesystem]
27 May 06:42:18 - [info] User directory : \Users\Pc\.node-red
27 May 06:42:18 - [warn] Projects disabled : editorTheme.projects.enabled=false
27 May 06:42:18 - [info] Flows file : \Users\Pc\.node-red\flows.json
27 May 06:42:18 - [info] Server now running at http://127.0.0.1:1880/
27 May 06:42:19 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

27 May 06:42:19 - [info] Starting flows
Connection options, transport settings: {}
Connection options, transport settings: {}
Connection options, transport settings: {}
Connection options, transport settings: {}
27 May 06:42:19 - [info] Started flows
04:42:25.194Z :populate_data_type_manager_104:51 Cannot find dataType Definition ! with nodeId =ns=2;i=6525
04:42:25.592Z :populate_data_type_manager_104:51 Cannot find dataType Definition ! with nodeId =ns=2;i=15889
04:42:25.600Z :populate_data_type_manager_104:51 Cannot find dataType Definition ! with nodeId =ns=2;i=15888

```

 ![Skärmbild 2024-05-27 064430](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f3fb88bded2cf48cb8209cb38a46470c4a16031.png)

The problem apeared when the pc was turned off during the weekend and then was started this morning.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [10 June 2024 04:49 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/6 "2024-06-10T04:49:46Z")

</div>

Can you locate the problem in the output I posted?

---

<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 June 2024 07:35 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/7 "2024-06-10T07:35:32Z")

</div>

I have editted your post to add tripple backticks around the output so that the forum does not interpret it a markdown.

Did you do anything between those run attempts? If you did not then the file system is not giving you consistent data so you have something very wrong with your system. I don't know much about Windows so can't really help much with that. You probably want to make sure everything is backed up and then run a check disk operation.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [10 June 2024 07:53 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/8 "2024-06-10T07:53:10Z")

</div>

Thanks,  
for the first three attempts I tried to delete different files in the folder "C:\Users\Pc\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\context" but it didn't help.  
Last time I deleted the files inte the folder "\Users\Pc.node-red\context" and then it starts without problem.

---

<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 June 2024 08:42 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/9 "2024-06-10T08:42:12Z")

</div>

> [@larro96](#):
>
> I tried to delete different files in the folder "C:\Users\Pc\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\runtime\lib\nodes\context" but it didn't help.

Deleting anything inside `"C:\Users\Pc\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\***` will break Node-RED! Those are the actual source code files that makes Node-RED run (they are not data files that can be simply cleaned up!)

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [10 June 2024 09:42 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/10 "2024-06-10T09:42:55Z")

</div>

Understood.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [17 June 2024 09:40 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/11 "2024-06-17T09:40:59Z")

</div>

Do you have any solution on my problem?

---

<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 June 2024 10:10 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/12 "2024-06-17T10:10:49Z")

</div>

You said that you had deleted the context file and it started without problems, so it isn't clear what is not working for you.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [17 June 2024 10:27 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/13 "2024-06-17T10:27:26Z")

</div>

Okay, if I turn off the PC now for a weekend then I will get the same problem when I start the PC.

I've deleted the files in the context folder about 5 times this year because of power outage.

---

<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 June 2024 10:31 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/14 "2024-06-17T10:31:08Z")

</div>

Do you mean you get the corruption even when there has not been a power outage?

I suggest you upgrade to the latest version of node red. I am not aware of any changes in that area since 3.0.2 but you need to upgrade first just in case.

The next time it happens, post the contents of the file before deleting it.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [17 June 2024 10:37 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/15 "2024-06-17T10:37:50Z")

</div>

No, the corruption only happens after power outage.

Okay, I will try that.

I've saved all the files from the context folder from each corruption, shall I post them here as a archived folder?

---

<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 June 2024 10:56 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/16 "2024-06-17T10:56:18Z")

</div>

> [@larro96](#):
>
> I've saved all the files from the context folder from each corruption, shall I post them here as a archived folder?

Just post a typical one.

Do you have any other problems with your machine after an outage?

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [17 June 2024 15:35 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/17 "2024-06-17T15:35:36Z")

</div>

I could not upload a archived folder here so you can download it from here:  
**[https://sprend.com/download?C=5d93f86b7b1c4de2a4af9bc4b39c7b2a](https://sprend.com/download?C=5d93f86b7b1c4de2a4af9bc4b39c7b2a)**

I do not have problem with anything else, after an outage I have to delete the context folder and start node-red, then the machine is up and running fine.

---

<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:** [17 June 2024 15:59 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/18 "2024-06-17T15:59:42Z")

</div>

> [@larro96](#):
>
> ```auto
> Error loading context store: Error: Invalid JSON in context file '\Users\Pc\.node-red\context\b1531b115956bc02\dcea7f832804799a.json'
> 
> ```

The `b1531b115956bc02` in that error message is the ID of an editor tab.  
It would be useful to see an export of that tab too.

There may be a simple way to get the tab name (the "label" property) from the ID but I'm not aware how, so here is a flow to extract it from the flows file (you might need to change the flows file pathname)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1ee49fcea39505e487b16f6264fc0b010c050b1a.png)

```auto
[{"id":"e354973541e14b65","type":"inject","z":"e56de693d0e0a509","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"b1531b115956bc02","payloadType":"str","x":210,"y":100,"wires":[["4cf75cfcb9feb511"]]},{"id":"f3fdbbee199ddbdd","type":"file in","z":"e56de693d0e0a509","name":"","filename":".node-red/flows.json","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":200,"y":160,"wires":[["9a585a43f3963148"]]},{"id":"59168d428a3de93c","type":"switch","z":"e56de693d0e0a509","name":"","property":"payload.id","propertyType":"msg","rules":[{"t":"eq","v":"chosenNodeId","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":220,"wires":[["bc7fbdf1c70efe94"]]},{"id":"9a585a43f3963148","type":"json","z":"e56de693d0e0a509","name":"","property":"payload","action":"","pretty":false,"x":490,"y":160,"wires":[["43b49091765ec263"]]},{"id":"bc7fbdf1c70efe94","type":"debug","z":"e56de693d0e0a509","name":"debug 115","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":220,"wires":[]},{"id":"43b49091765ec263","type":"split","z":"e56de693d0e0a509","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":150,"y":220,"wires":[["59168d428a3de93c"]]},{"id":"4cf75cfcb9feb511","type":"change","z":"e56de693d0e0a509","name":"","rules":[{"t":"set","p":"chosenNodeID","pt":"flow","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":100,"wires":[["f3fdbbee199ddbdd"]]}]

```

Can you show us what is on that editor tab? A screen capture would help but an export is always better.

---

<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 June 2024 17:58 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/19 "2024-06-17T17:58:57Z")

</div>

> [@larro96](#):
>
> I could not upload a archived folder here so you can download it from here:

We don't want to see the whole folder, just one of the files that it complained about.

---

<div class="post-metadata">

**Author:** ![larro96](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@larro96](https://discourse.nodered.org/u/larro96)\
**Post date:** [17 June 2024 18:20 UTC](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224/20 "2024-06-17T18:20:56Z")

</div>

[dcea7f832804799a.json](https://discourse.nodered.org/uploads/short-url/eKM1AhlPDm1tMNWquCF3TgroUqP.json) (20 Bytes)  
Okay, this one then.

[Next page](https://discourse.nodered.org/t/node-red-dashboard-refused-to-connect/88224.md?page=2)
