Catch (someone) off guard

To catch a person at a time of carelessness.

I was caught off guard when the teacher asked me about my homework.