# Unknown command: undefined

**URL:** https://discourse.nodered.org/t/unknown-command-undefined/75444
**Category:** General
**Created:** [20 February 2023 06:21 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444 "2023-02-20T06:21:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)
#### Post date: [20 February 2023 06:21 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/1 "2023-02-20T06:21:48Z")

</div>

Hi Everyone,

i facing this undefined error can teach what miss take i did.  
thanks

```auto
[{"id":"d84226f6b77e2c62","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"c1adc51e4988d703","type":"inject","z":"d84226f6b77e2c62","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"RED light","payload":"true","payloadType":"bool","x":290,"y":360,"wires":[["c57cdff808841490"]]},{"id":"ee1b02527654bc1d","type":"inject","z":"d84226f6b77e2c62","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Green light","payload":"false","payloadType":"bool","x":280,"y":400,"wires":[["c57cdff808841490"]]},{"id":"5a077f8f2b734b0c","type":"debug","z":"d84226f6b77e2c62","name":"debug 27","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1100,"y":380,"wires":[]},{"id":"9f4cdbf0a3a9e38b","type":"gate","z":"d84226f6b77e2c62","name":"","controlTopic":"control","defaultState":"open","openCmd":"start","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":810,"y":380,"wires":[["94b3249155e4314d"]]},{"id":"94b3249155e4314d","type":"hourglass","z":"d84226f6b77e2c62","name":"","persistId":"","humanizeLocale":"","x":940,"y":380,"wires":[["5a077f8f2b734b0c"]]},{"id":"c57cdff808841490","type":"function","z":"d84226f6b77e2c62","name":"function 3","func":"// @ts-nocheck\n\nmsg.topic = String(msg.topic)\nif (msg.topic == \"RED light\" && msg.payload == true) {\n msg.topic = \"RED light\"\n msg.payload = {\n \"OK\": 0,\n \"Error\": 1,\n }\n} else if (msg.topic == \"Green light\" && msg.payload == false) {\n msg.topic = \"Green light\"\n msg.payload = {\n \"OK\": 1,\n \"Error\": 0,\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":380,"wires":[["5ec45f075837927b"]]},{"id":"5ec45f075837927b","type":"trigger","z":"d84226f6b77e2c62","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":680,"y":380,"wires":[["9f4cdbf0a3a9e38b"]]}]

```

---

<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: [20 February 2023 06:38 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/2 "2023-02-20T06:38:48Z")

</div>

> [@kelvin](#):
>
> this undefined error

What is undefined ?

Whatever nodes you are using, they expect certain input, if it does not exist they will tell you it is undefined.  
You will need to define them/it.

---

<div class="post-metadata">

### Author: ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)
#### Post date: [20 February 2023 06:42 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/3 "2023-02-20T06:42:06Z")

</div>

@bakman2  
actually mine is "Unknown command: undefined"  
but even i change to boolean or string but still does't work

---

<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: [20 February 2023 06:51 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/4 "2023-02-20T06:51:59Z")

</div>

And which node produces that error. Does the node have documentation describing what it expects as input ?

---

<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: [20 February 2023 09:15 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/5 "2023-02-20T09:15:53Z")

</div>

1. debug your flow - remove a node at a time till you determine what node is causing the error
2. also add a `catch` node connected to a `debug` node - set to display the complete msg object and see what it tells you.
3. when you determine what node is the issue, add a 'debug' node to the output node that is feeding the node in error. So if you have n1-\>n2-\>n3 and `n3` is the bad node, add a `debug`  
to the output of n2 and see what it tells you
4. Using your new found information, read the `Help` tab for the node causing the problem (`n3`) and see what it tells you

---

<div class="post-metadata">

### Author: ![kelvin](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kelvin](https://discourse.nodered.org/u/kelvin)
#### Post date: [20 February 2023 09:35 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/6 "2023-02-20T09:35:30Z")

</div>

ok thanks

---

<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: [21 April 2023 09:35 UTC](https://discourse.nodered.org/t/unknown-command-undefined/75444/7 "2023-04-21T09:35:56Z")

</div>

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