# RangeError issue with buffer-parser node (Attempt to access memory outside buffer bounds)

**URL:** <https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761>\
**Category:** General\
**Created:** [20 March 2023 17:08 UTC](https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761 "2023-03-20T17:08:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/darren/32/92202_2.png) [@Darren](https://discourse.nodered.org/u/Darren)\
**Post date:** [20 March 2023 17:08 UTC](https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761/1 "2023-03-20T17:08:23Z")

</div>

Screenshot:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc5538dfb39fb2e72dcf2817750e943317363f8f.png)

node-red-contrib-buffer-parser is erroring with `RangeError: Attempt to access memory outside buffer bounds`, but is only receiving an empty array at the moment due to sensors being shut-down. It appears to be causing a noticeable slowdown with node-red deployment and loading (peak CPU load is around 5% on the RPi), and I'm not sure how to better handle this error.

Can anyone advise on possible solutions?

Many thanks,

---

<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:** [20 March 2023 17:15 UTC](https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761/2 "2023-03-20T17:15:52Z")

</div>

Use a switch node to check the payload BEFORE it goes into the buffer parser. If the msg.payload.length is 0, don't let the message pass.

---

<div class="post-metadata">

**Author:** ![Darren](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/darren/32/92202_2.png) [@Darren](https://discourse.nodered.org/u/Darren)\
**Post date:** [20 March 2023 18:04 UTC](https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761/3 "2023-03-20T18:04:00Z")

</div>

Thank you so much! That has solved the issue with buffer-parser!

My connection to node-red is still sluggish, but I suspect that may be our clients' internet connection, or I need to implement stricter rate limits elsewhere in the code.

---

<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:** [3 April 2023 18:04 UTC](https://discourse.nodered.org/t/rangeerror-issue-with-buffer-parser-node-attempt-to-access-memory-outside-buffer-bounds/76761/4 "2023-04-03T18:04:32Z")

</div>

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