Ask for trouble

To behave in a way that will likely cause trouble.

The boy is asking for trouble if he misses another class.