Are you running this script in the background? The message refers to setting an attribute of a terminal, but the value of the terminal name supplied cannot be resolved.
Check the script to see if there are any references to the 'stty' command, or if you are happy with the output, redirect stderr to /dev/null.