# Help with understanding \*errors\* as they are shown

**URL:** <https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740>\
**Category:** General\
**Created:** [25 April 2022 03:29 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740 "2022-04-25T03:29:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [25 April 2022 03:29 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/1 "2022-04-25T03:29:21Z")

</div>

# This is a question in the broader sense that I am confused by WHAT is shown rather than the specifics of the error itself.

A couple of days back I got this error:  
`{"message":"TypeError: msg.payload.sort is not a function","source":{"id":"90fd90b2.99848","type":"function","name":"Native JS Sort","count":1}}`

And the part that got me was/is this part:

`TypeError: msg.payload.sort is not a function`

Now I am confused because in the bigger scheme of things the node worked/works and I just stuffed up the use of that node.

To me HOW I was told is misleading.  
The words are very clear to me - but I'm illiterate.  
`msg.payload.sort is not a function`.

But it is! Or it wouldn't be written like that.

How have I got _the bull by the horns_?  
I'm asking because I fear this is causing me a lot of grief for no real reason other than I don't believe it, and so am wasting time looking in the wrong places when tracking down errors.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [25 April 2022 05:46 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/2 "2022-04-25T05:46:00Z")

</div>

> `msg.payload.sort is not a function` .

If you inject values that it cannot "function on", you will get this error.

`human.fly()` is not a function

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [25 April 2022 05:56 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/3 "2022-04-25T05:56:09Z")

</div>

Ok.... But @Steve-Mcl made a simple subflow he posted for _me_ to use on a project.

It works.

I used the flow works as he showed it and I tested it in it's demonstration flow.  
It worked.

I stuffed up and didn't use/include a `function` node upstream in the example he gave me.  
So that node not being in the flow I .. used.... it threw an error.  
[This is his flow.](https://flows.nodered.org/flow/63f29373e826a9fd4943d679d43e725f)

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [26 April 2022 02:39 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/4 "2022-04-26T02:39:36Z")

</div>

You mentioned you didn't understand what it meant, rather than your specific example.

Here is the explanation in general terms [TypeError: "x" is not a function - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 April 2022 05:56 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/5 "2022-04-26T05:56:35Z")

</div>

I'm shooting myself in the foot by saying it, but that looks complicated.

However it seems counter intuitive how the errors are reported.

---

<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:** [10 May 2022 05:59 UTC](https://discourse.nodered.org/t/help-with-understanding-errors-as-they-are-shown/61740/6 "2022-05-10T05:59:00Z")

</div>

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