It is likely stems from the initialization state of HDFS at the time the bootstrap action runs. HDFS may not yet be fully initialized and ready to accept commands when your script is executed.
Using a delay or moving the directory creation to a custom step after cluster startup should resolve the problem. Debugging the logs will provide further insight.