# ERR\_INVALID\_ARG\_VALUE using Exec node

**URL:** https://discourse.nodered.org/t/err-invalid-arg-value-using-exec-node/35260
**Category:** General
**Created:** [3 November 2020 07:42 UTC](https://discourse.nodered.org/t/err-invalid-arg-value-using-exec-node/35260 "2020-11-03T07:42:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Fucio7](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Fucio7](https://discourse.nodered.org/u/Fucio7)
#### Post date: [3 November 2020 07:42 UTC](https://discourse.nodered.org/t/err-invalid-arg-value-using-exec-node/35260/1 "2020-11-03T07:42:57Z")

</div>

Hi all.

I'm trying to send a command to the "Exec" node, but I always get this error: `TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''`.

I'm using a function node to set `msg.command` with my command and then pass the message to the "Exec" node.

Here my flow  
`[{"id":"31a7b70f.cfcbb8","type":"inject","z":"88792789.5de198","name":"","topic":"","payload":"!","payloadType":"str","repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["33ed1748.4becb8"]]},{"id":"e8ec88db.e13518","type":"exec","z":"88792789.5de198","command":"","addpay":false,"append":"","useSpawn":"false","timer":"120","oldrc":false,"name":"","x":350,"y":100,"wires":[[],[],["b585bfa8.79a9b8"]]},{"id":"33ed1748.4becb8","type":"function","z":"88792789.5de198","name":"","func":"var today = new Date();\ntoday.setTime(today.getTime());\nvar date = today.getFullYear() + \"\" + (today.getMonth() + 1) + \"\" + ('00' + today.getDate()).slice(-2);\n\nvar filename = 'log/' + date + '/log.txt';\n\nmsg.command = \"mkdir log/\" + date + \" && touch \" + filename;\nmsg.filename = filename;\n\nreturn msg","outputs":1,"noerr":0,"x":230,"y":100,"wires":[["e8ec88db.e13518"]]},{"id":"b585bfa8.79a9b8","type":"switch","z":"88792789.5de198","name":"","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":100,"wires":[[],[]]}]`

If I write the command in the "Command" property it works perfectly.

What's the problem?

---

<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: [3 November 2020 08:08 UTC](https://discourse.nodered.org/t/err-invalid-arg-value-using-exec-node/35260/2 "2020-11-03T08:08:09Z")

</div>

Hi, I see you set `msg.command` in your function expecting that to be used in the `exec` node. There is no where in the built in documentation that says use `msg.command`. Try setting `msg.payload` instead (in your function) and check the "append msg.payload" option.

---

<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: [17 November 2020 08:08 UTC](https://discourse.nodered.org/t/err-invalid-arg-value-using-exec-node/35260/3 "2020-11-17T08:08:09Z")

</div>

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