# "TypeError: Cannot read property '0' of undefined"

**URL:** <https://discourse.nodered.org/t/typeerror-cannot-read-property-0-of-undefined/28285>\
**Category:** General\
**Created:** [13 June 2020 16:45 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-0-of-undefined/28285 "2020-06-13T16:45:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devshri](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/devshri/32/23898_2.png) [@devshri](https://discourse.nodered.org/u/devshri)\
**Post date:** [13 June 2020 16:45 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-0-of-undefined/28285/1 "2020-06-13T16:45:36Z")

</div>

output: object

predictions: array[1]

0: object

fields: array[1]

0: "prediction"

values: array[1]

0: array[1]

0: 67

error: :"TypeError: Cannot read property '0' of undefined"

code in function:msg.payload=msg.payload.predictions[0].values[0][0];  
return msg;

where it went wrong?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 June 2020 16:55 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-0-of-undefined/28285/2 "2020-06-13T16:55:03Z")

</div>

Have a look at this - [https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)  
to see how to find the correct path to the data you want.

Also see this post on how to share code and debug so that it is easier to read and import - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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:** [12 August 2020 16:55 UTC](https://discourse.nodered.org/t/typeerror-cannot-read-property-0-of-undefined/28285/3 "2020-08-12T16:55:03Z")

</div>

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