What everyone else said. Your snake is stressed and not feeling well. If you need somewhere to stash him while you clean his enclosure, secure him in a bag or small bin so he feels secure. When you put him down next to you in an open area he feels exposed and will strike at any shadows or movement he perceives as a threat.