# Uncaught Exception | When the global variables are not defined, but used in a node

**URL:** <https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632>\
**Category:** General\
**Created:** [28 September 2023 10:59 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632 "2023-09-28T10:59:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayurkhadse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mayurkhadse/32/83280_2.png) [@mayurkhadse](https://discourse.nodered.org/u/mayurkhadse)\
**Post date:** [28 September 2023 10:59 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/1 "2023-09-28T10:59:18Z")

</div>

There comes an exception if the global variables are not defined and we try to launch the Node red and in a node the global variables are being read.

```auto
28 Sep 12:53:23 - [error] TypeError: Cannot read properties of undefined (reading 'indexOf')
    at MQTTBrokerNode.node.setOptions (C:\Users\###\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\nodes\core\network\10-mqtt.js:590:33)
    at C:\Users\###\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\nodes\core\network\10-mqtt.js:423:37
    at _callback (C:\Users\###\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\nodes\core\network\10-mqtt.js:834:62)
    at C:\Users\###\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\nodes\core\network\10-mqtt.js:869:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)`

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 September 2023 11:13 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/2 "2023-09-28T11:13:30Z")

</div>

Please can you raise an issue on github for this: [Issues · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues)

Please include more details so we can quickly recreate.

---

<div class="post-metadata">

**Author:** ![mayurkhadse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mayurkhadse/32/83280_2.png) [@mayurkhadse](https://discourse.nodered.org/u/mayurkhadse)\
**Post date:** [28 September 2023 12:25 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/3 "2023-09-28T12:25:09Z")

</div>

@knolleary Sure will do that.

---

<div class="post-metadata">

**Author:** ![mayurkhadse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mayurkhadse/32/83280_2.png) [@mayurkhadse](https://discourse.nodered.org/u/mayurkhadse)\
**Post date:** [11 October 2023 07:42 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/4 "2023-10-11T07:42:16Z")

</div>

@knolleary , i assume that the bug is in MQTT Nodes, how can i report that ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 October 2023 08:21 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/5 "2023-10-11T08:21:49Z")

</div>

Hi @mayurkhadse

The MQTT nodes are maintained in the core repository I linked to previously. Please raise an issue there.

---

<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:** [11 October 2023 10:03 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/6 "2023-10-11T10:03:33Z")

</div>

For anyone finding this thread, the OP has raised an issue here: [Uncaught Exception | When the global variables are not defined, but used in a node · Issue #4380 · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues/4380)

---

<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 December 2023 10:03 UTC](https://discourse.nodered.org/t/uncaught-exception-when-the-global-variables-are-not-defined-but-used-in-a-node/81632/7 "2023-12-10T10:03:50Z")

</div>

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