A question that arose in my thought:
What is the hallacha if a sofer had a mistake in shem that was pasul, but forbidden to erase, he didn't ask and erased the shem b'isur and rewrote the shem kodesh in place of the first one. Is this shem kosher and permitted to maintain bdieved, or must be fixed [probably by kiluf]?
See teshuvas R"Y ben Ha'Rosh quoted by BY end of YD Siman 276, that it would have been preferable to goinez the whole yriya and not cut out the shem - mashma after the fact that they did cut out the shem it isn't pasul - But the R"Y concludes since a sin was done [in regard to erasing the shem] it is best to change the yeriya. See also Shu"t Chatam Sofer YD simanim 264, 279.