That happened to me couple of times, usually when I changed the database and didn´t refresh .netTiers source tables... what I started doing was to finish any database changes and then open CodeSmith.
Also, make sure the folder you´re generating to is not read-only. I´ve had some problems with that as well.