# node-RED crashing with 'Invalid Websocket Frame'

**URL:** https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210
**Category:** General
**Created:** [22 May 2025 14:56 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210 "2025-05-22T14:56:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [22 May 2025 14:56 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210/1 "2025-05-22T14:56:21Z")

</div>

I'm running a flow using `node-red-contrib-ocpp`, and have had a few node-RED crashes over the past week when that flow is running.  
In the logfile I see it's linked to a 'Invalid WebSocket frame: RSV1 must be clear' error.  
I've googled the error, but not found an answer that I can comprehend!!  
I believe that the websocket is managed from within the ocpp node (I'm not using a websocket node).  
Is there anything I can do to catch the error, other than raise a git issue?  
Any thoughts or advice @bnystrom

```auto
May 22 14:33:28 homeserver Node-RED[2388]: 2025-05-22 14:33:28.945 FATAL Logger Unhandled error detected: Invalid WebSocket frame: RSV1 must be clear
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver.getInfo (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:184:14)
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver.startLoop (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:131:22)
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver._write (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:78:10)
May 22 14:33:28 homeserver Node-RED[2388]: at writeOrBuffer (node:internal/streams/writable:572:12)
May 22 14:33:28 homeserver Node-RED[2388]: at _write (node:internal/streams/writable:501:10)
May 22 14:33:28 homeserver Node-RED[2388]: at Writable.write (node:internal/streams/writable:510:10)
May 22 14:33:28 homeserver Node-RED[2388]: at Socket.socketOnData (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/websocket.js:1164:35)
May 22 14:33:28 homeserver Node-RED[2388]: at Socket.emit (node:events:524:28)
May 22 14:33:28 homeserver Node-RED[2388]: at addChunk (node:internal/streams/readable:561:12)
May 22 14:33:28 homeserver Node-RED[2388]: at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
May 22 14:33:28 homeserver Node-RED[2388]: 22 May 14:33:28 - [red] Uncaught Exception:
May 22 14:33:28 homeserver Node-RED[2388]: 22 May 14:33:28 - [error] RangeError: Invalid WebSocket frame: RSV1 must be clear
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver.getInfo (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:184:14)
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver.startLoop (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:131:22)
May 22 14:33:28 homeserver Node-RED[2388]: at Receiver._write (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/receiver.js:78:10)
May 22 14:33:28 homeserver Node-RED[2388]: at writeOrBuffer (node:internal/streams/writable:572:12)
May 22 14:33:28 homeserver Node-RED[2388]: at _write (node:internal/streams/writable:501:10)
May 22 14:33:28 homeserver Node-RED[2388]: at Writable.write (node:internal/streams/writable:510:10)
May 22 14:33:28 homeserver Node-RED[2388]: at Socket.socketOnData (/home/me/.node-red/node_modules/express-ws/node_modules/ws/lib/websocket.js:1164:35)
May 22 14:33:28 homeserver Node-RED[2388]: at Socket.emit (node:events:524:28)
May 22 14:33:28 homeserver Node-RED[2388]: at addChunk (node:internal/streams/readable:561:12)
May 22 14:33:28 homeserver Node-RED[2388]: at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
May 22 14:33:29 homeserver systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
May 22 14:33:29 homeserver systemd[1]: nodered.service: Failed with result 'exit-code'.
May 22 14:33:29 homeserver systemd[1]: nodered.service: Consumed 3h 5min 2.933s CPU time.

```

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [22 May 2025 15:01 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210/2 "2025-05-22T15:01:09Z")

</div>

While a bit esoteric, the error explanation seems clear.

This from Brave's Leo AI:

> Invalid WebSocket Frame
> 
> An error "Invalid WebSocket frame: RSV1 must be clear" typically indicates that the RSV1 bit in the WebSocket frame header is set to 1, which is not allowed unless an extension has been negotiated that defines a meaning for a non-zero value of RSV1. According to the WebSocket protocol specification, RSV1, RSV2, and RSV3 bits must be 0 unless an extension is negotiated that defines meanings for non-zero values. If a nonzero value is received and none of the negotiated extensions defines the meaning of such a nonzero value, the receiving endpoint must fail the WebSocket connection
> 
> This error can occur in various WebSocket implementations, such as the ws library for Node.js, where it is reported as an issue in version 3.0.0
> 
> To resolve this issue, ensure that any extensions that define the meaning of non-zero RSV bits are properly negotiated and that the WebSocket frames adhere to the protocol specification

To me, that means that yes, you will have to report it to the node's author. At the very least, the node should catch the error so that Node-RED doesn't crash.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [22 May 2025 16:41 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210/3 "2025-05-22T16:41:07Z")

</div>

Thanks Julian, issue raised [Crashing node-RED - Invalid Web Socket Frame · Issue #95 · argonne-vci/node-red-contrib-ocpp · GitHub](https://github.com/argonne-vci/node-red-contrib-ocpp/issues/95)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [22 May 2025 16:41 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210/4 "2025-05-22T16:41:41Z")

</div>

Now lets see if they know how to fix it! 😃

---

<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: [20 August 2025 16:42 UTC](https://discourse.nodered.org/t/node-red-crashing-with-invalid-websocket-frame/97210/5 "2025-08-20T16:42:23Z")

</div>

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