macbook pro – Upon restart, mac blasts fan and then boots up saying “your computer ran into a problem”

Whenever I restart my macbook, it exits all my windows and then right as it’s shutting down (or maybe starting back up) it blasts the fan very loudly for 1 second, and then boots up saying “your mac restarted because of a problem”. Is this a hardware or software issue? Should I be worried or can I safely ignore it?