 
     action = msg.match[1]
     projname = msg.match[2].replace /\//, "_"
+
+    unless fs.existsSync("#{basepath}/#{projname}")
+      return msg.send {room: msg.message.user.name}, "Invalid project name."
 
     exec "cd #{basepath}/#{projname}; terraform #{action} -input=false -no-color", (error, stdout, stderr) ->
       if stderr

    projname = msg.match[1].replace /\//, "_"
    ekey = msg.match[2]

    return msg.send {room: msg.message.user.name}, "`#{projname}` env unset: `#{ekey}`"

    action = msg.match[1]
    projname = msg.match[2].replace /\//, "_"

    unless fs.existsSync("#{basepath}/#{projname}")
      return msg.send {room: msg.message.user.name}, "Invalid project name."

    exec "cd #{basepath}/#{projname}; terraform #{action} -no-color", (error, stdout, stderr) ->
      if stderr
        msg.send {room: msg.message.user.name}, "stderr:\n```\n#{stderr}\n```"
