# Unexpected Node Error

**URL:** https://discourse.nodered.org/t/unexpected-node-error/81820
**Category:** General
**Created:** [6 October 2023 07:08 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820 "2023-10-06T07:08:43Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![pacmanmt](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@pacmanmt](https://discourse.nodered.org/u/pacmanmt)
#### Post date: [6 October 2023 07:08 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/1 "2023-10-06T07:08:43Z")

</div>

Hi all, I am getting the following error into the syslog of the raspi where nodered is running.  
It is suggested to report the error on github, but before thronging there, I would like to ask here:

```auto
Oct 05 08:17:34 houston Node-RED[658]: 5 Oct 08:17:34 - [error]
Oct 05 08:17:34 houston Node-RED[658]: ********************************************************************
Oct 05 08:17:34 houston Node-RED[658]: Unexpected Node Error
Oct 05 08:17:34 houston Node-RED[658]: ********************************************************************
Oct 05 08:17:34 houston Node-RED[658]: Info:
Oct 05 08:17:34 houston Node-RED[658]: Node object is not a node-red Node
Oct 05 08:17:34 houston Node-RED[658]: Stack:
Oct 05 08:17:34 houston Node-RED[658]: Error: Invalid payload type (undefined): expected number, boolean, string
Oct 05 08:17:34 houston Node-RED[658]: at log_helper (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:512:20)
Oct 05 08:17:34 houston Node-RED[658]: at Node.error (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:553:9)
Oct 05 08:17:34 houston Node-RED[658]: at parsePayload (/home/rob/.node-red/node_modules/node-red-contrib-moving-average/moving-average.js:49:1>
Oct 05 08:17:34 houston Node-RED[658]: at MovingAverageNode._inputCallback (/home/rob/.node-red/node_modules/node-red-contrib-moving-average/mo>
Oct 05 08:17:34 houston Node-RED[658]: at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26
Oct 05 08:17:34 houston Node-RED[658]: at Object.trigger (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/hooks.js:166:13)
Oct 05 08:17:34 houston Node-RED[658]: at MovingAverageNode.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/>
Oct 05 08:17:34 houston Node-RED[658]: at MovingAverageNode.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/>
Oct 05 08:17:34 houston Node-RED[658]: at MovingAverageNode.Node.receive (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nod>
Oct 05 08:17:34 houston Node-RED[658]: at Immediate._onImmediate (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.>
Oct 05 08:17:34 houston Node-RED[658]: Please report this issue, including the information logged above:
Oct 05 08:17:34 houston Node-RED[658]: https://github.com/node-red/node-red/issues/
Oct 05 08:17:34 houston Node-RED[658]: ********************************************************************

```

Thank you for helping out

---

<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: [6 October 2023 07:15 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/2 "2023-10-06T07:15:46Z")

</div>

> [@pacmanmt](#):
>
> `node-red-contrib-moving-average/moving-average`

To me I would uninstall this node and see what happens then.

It may require a restart.

Sorry if this seems a bit severe.

Do you have much of a flow?

---

<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: [6 October 2023 07:30 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/3 "2023-10-06T07:30:47Z")

</div>

> [@pacmanmt](#):
>
> `node-red-contrib-moving-average`

It looks like this ☝ node it not sending a correct msg object. That is a bug in itself and you should report your findings to the author via the GitHub issues.

That said, this bug may be unearthed due to what you are feeding into it? Put a debug node before this node and see what values cause it to error.

---

<div class="post-metadata">

### Author: ![pacmanmt](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@pacmanmt](https://discourse.nodered.org/u/pacmanmt)
#### Post date: [6 October 2023 09:43 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/4 "2023-10-06T09:43:08Z")

</div>

I have put a debug node on the output of the moving average node and I get no errors

```auto
10/6/2023, 11:40:36 AMnode: debug 1
msg : Object
object
payload: 9.164227450980388
_msgid: "be5f556b7d020a5f"
payload_in: 6.09

```

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 October 2023 10:08 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/5 "2023-10-06T10:08:40Z")

</div>

This node hasn't been updated in over 2 years.

This is a known issue with the node and was reported over a year ago with no response from the node's author, however there is a 'get around' provided by another user.

> <https://github.com/AmyAmy/node-red-contrib-moving-average/issues/11>
>
> Getting this warning when an undefined vaiable payload is passed in raspberry pi…
> 
> Posting issue on request : \[https://discourse.nodered.org/t/node-object-is-not-a-node-red-node-error/66262\](url)
> 
> \`\`\`node-red-log
> 
> 11 Aug 15:01:00 - \[error\]
> 
> Unexpected Node Error
> 
> Info:
> Node object is not a node-red Node
> Stack:
> Error: Invalid payload type (undefined): expected number, boolean, string
> at log\_helper (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:512:20)
> at Node.error (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:553:9)
> at parsePayload (/home/pi/.node-red/node\_modules/node-red-contrib-moving-average/moving-average.js:49:13)
> at MovingAverageNode.\_inputCallback (/home/pi/.node-red/node\_modules/node-red-contrib-moving-average/moving-average.js:64:39)
> at /usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:210:26
> at Object.trigger (/usr/lib/node\_modules/node-red/node\_modules/@node-red/util/lib/hooks.js:166:13)
> at MovingAverageNode.Node.\_emitInput (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:202:11)
> at MovingAverageNode.Node.emit (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:186:25)
> at MovingAverageNode.Node.receive (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:485:10)
> at Immediate.\_onImmediate (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/flows/Flow.js:831:52)
> at processImmediate (internal/timers.js:464:21)
> Please report this issue, including the information logged above:
> https://github.com/node-red/node-red/issues/
> 
> \`\`\`

You might want to try this node instead:

> **[@racksync/node-red-contrib-moving-average](https://flows.nodered.org/node/@racksync/node-red-contrib-moving-average)**
>
> Computes the moving average of incoming message payloads using a window size defined.

---

<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: [6 October 2023 11:57 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/6 "2023-10-06T11:57:50Z")

</div>

> [@pacmanmt](#):
>
> I have put a debug node on the output of the moving average

Why?

I said

> [@Steve-Mcl](#):
>
> this bug may be unearthed due to what you are feeding into it? Put a debug node before this node and see what values cause it to error.

Which as it turns out is exactly the problem we would have discovered as @zenofmud has linked to.

---

<div class="post-metadata">

### Author: ![pacmanmt](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@pacmanmt](https://discourse.nodered.org/u/pacmanmt)
#### Post date: [7 October 2023 06:58 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/7 "2023-10-07T06:58:15Z")

</div>

Sorry Steve-Mcl, I initially misread your advice. 🤔  
I then placed the debug before and saw that the topic was undefined, so gave a value to it and the error seems to be gone.  
Thank you so much 😀

---

<div class="post-metadata">

### Author: ![pacmanmt](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@pacmanmt](https://discourse.nodered.org/u/pacmanmt)
#### Post date: [7 October 2023 07:01 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/8 "2023-10-07T07:01:26Z")

</div>

Hi Zenofmud, I checked that the input was a number and it always was then, as wrote to Steve-Mcl, I saw that the topic was undefined and gave it a value.  
Thanks for pointing me to the new moving-average node, I will definitely give it a try.

Thank you so much 😀

---

<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: [6 December 2023 07:01 UTC](https://discourse.nodered.org/t/unexpected-node-error/81820/9 "2023-12-06T07:01:46Z")

</div>

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