# Error: TypeError: Cannot read properties of undefined (reading 'length')

**URL:** https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005
**Category:** General
**Created:** [5 August 2024 14:29 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005 "2024-08-05T14:29:56Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![j2002](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@j2002](https://discourse.nodered.org/u/j2002)
#### Post date: [5 August 2024 14:29 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/1 "2024-08-05T14:29:56Z")

</div>

I have an image that I use to create several devices. All I do is update node-RED with json version that corresponds to each one. Well, from time to time, with the same image, I get this error and I don't know what to attribute it to, if it's all identical. Any ideas?

---

<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: [5 August 2024 15:07 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/2 "2024-08-05T15:07:01Z")

</div>

What is in the node generating the error? Click on the node id above the message and it should take you there.

---

<div class="post-metadata">

### Author: ![j2002](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@j2002](https://discourse.nodered.org/u/j2002)
#### Post date: [5 August 2024 18:45 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/3 "2024-08-05T18:45:04Z")

</div>

The problem is that I have no information. It appears just after loading json file, before deploying

---

<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: [5 August 2024 19:02 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/4 "2024-08-05T19:02:56Z")

</div>

Where do you see it? Show us the full output where you see the message.

---

<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: [5 August 2024 20:12 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/5 "2024-08-05T20:12:16Z")

</div>

> [@j2002](#):
>
> update node-RED with json version that corresponds to each one.

Also explain _exactly_ what that means and how you do it.

---

<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: [5 August 2024 20:19 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/6 "2024-08-05T20:19:19Z")

</div>

You can get an error like that when you expect a payload to contain a property such as payload.box.length but for some reason payload.box does not exist.

This happens a lot with API calls when you receive an error message instead of the expected json.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/53e27118b3b42bf290a25cc5fa44fe727e977fcb.png)

---

<div class="post-metadata">

### Author: ![j2002](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@j2002](https://discourse.nodered.org/u/j2002)
#### Post date: [6 August 2024 09:25 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/7 "2024-08-06T09:25:38Z")

</div>

All devices run the same node-red flow so I have to personalize with their little differences (serial number, size and other parameters)  
Also, I`m improving the flow continuously.  
I have an image with the distro and node installed so, when I have to "build" another device, I write the image, update, deploy the updated flow and that's all.  
Well, from time to time, one device shows that error when loading the json file. I have just found a walkaround: deploy and older version of my flow, and then, the last one.  
I will paste a picture when it happens again but there's no info about the problematic node; only what's said on the title of the topic.

---

<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: [6 August 2024 10:45 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/8 "2024-08-06T10:45:57Z")

</div>

> [@j2002](#):
>
> one device shows that error when loading the json file

As I asked, what do you mean by 'loading the json file'?

---

<div class="post-metadata">

### Author: ![j2002](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@j2002](https://discourse.nodered.org/u/j2002)
#### Post date: [6 August 2024 13:34 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/9 "2024-08-06T13:34:19Z")

</div>

That is

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/86075d5309a9a641f9b50925fe5e561d8684a1c4.png)  
After "Import" button and "Import copy" button instead of a message with information about imported nodes and flows I get that warning.

---

<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: [6 August 2024 13:40 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/10 "2024-08-06T13:40:42Z")

</div>

OK, so say to import the flow, it says there are duplicate nodes and you select Import Copy and then you see the error. That is odd.

Can you tell us more about the system please? What h/w and OS are you running on and how did you install node-red. Are you using Docker?

Also show us the node red startup log that you see when starting node-red in a command window please. It should start with Welcome to Node Red. Copy/paste please, not screenshot. That will tell us a lot about your system.

---

<div class="post-metadata">

### Author: ![j2002](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@j2002](https://discourse.nodered.org/u/j2002)
#### Post date: [6 August 2024 13:48 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/11 "2024-08-06T13:48:52Z")

</div>

All devices are RaspberryPi 4. I really do not start node because de image I write it already has node 4.0.1 installed and running. As I said, I only update the system (the actual image has around two months) and the flow. Anyway, when it happens to my again (I have three devices to prepare today), I will paste the image but I'm not sure it will give more information than already given.

---

<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: [6 August 2024 14:14 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/12 "2024-08-06T14:14:21Z")

</div>

> [@j2002](#):
>
> I really do not start node because de image I write it already has node 4.0.1 installed and running

It would be useful if you could restart node-red so that we can see the startup.

---

<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: [4 November 2024 14:14 UTC](https://discourse.nodered.org/t/error-typeerror-cannot-read-properties-of-undefined-reading-length/90005/13 "2024-11-04T14:14:36Z")

</div>

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