@guest-001 The original poster had problems when starting runcommand.sh from /etc/rc.local, for which the solution was to change the /dev/tty to /dev/tty1.
There is no reported problem when using runcommand.sh normally, from ES, so I was wondering if you had a similar script set-up - especially since you were talking about noticing an error when a SSH connection was made before ES starts.
I don't know what might trigger your problems, but if you can reliably reproduce it from a RetroPie image, then share the steps necessary to get the error and we can try and see where the problem occurs.