>It's better to handle this automatically, for exampl, if you found the same folder exist, generate random folder as you do for working folder, and do the customize/build in that folder. After building, remove that random folder.

Agree, in ideal way, we can create a temp folder (like output folder of building) first of all, then do everything in that until the package is zipped well.  But there are many functions referring to the folder of "sanitized_name", means, too many modifications involved for existing code. 
>If you want it simple, you could print the error information to notify user switch to other folder for building.
So, prefer this one.