I had the same thing happen to one of my Indigos. It was a hole cut in a plastic hide box. some damage to the snakes scales, that have healed up good after a few sheds. I do not use any hides with holes in them anymore that can potentionally have the snake get caught up in.
Glad you got him out without harming you or the snake