Kernel panic during sleep mode 4 days ago my 2017 MacBook Pro started exhibiting a strange behaviour. Basically when it's in sleep mode, it crashes and when I open it I have to boot it again and the report shows a kernel panic, that is almost always identical, that says something like

Fatal error occurred. CSTS=0xffffffff
. FW Revision=CXS4JA0Q\n"@/BuildRoot/Library/Caches/com.apple.xbs/Sources/IONVMeFamily/IONVMeFamily-356.30.6/IONVMeController.cpp:5275


I haven't installed anything new in these days, I resetted the NVRAM, the RMC, I did diagnostic and first aid on the SSD, the problem is still there. Maybe it is also worth noting that the very first time that it happened there was also a flashing box with a question mark, but this happened only the first time.

Right now I have installed an app, Insomnia X, that prevents the laptop to go in sleep mode when I close the lid, but I would like to solve this problem. 

I'm hesitant to visit the Apple Store to check the hardware as I cannot go until the end of the month.

Is there a way to know if this is software or hardware in the mean time?
Try booting the MacBook Pro into Recovery or Internet Recovery mode (hold down cmd-R when booting for Recovery mode, or option-cmd-R for Internet Recovery mode).

Now you have booted in a "known good" configuration of software which is unaffected by any changed you may have made to the normal operating system on the Mac.

If sleep mode works fine here without kernel panics - you'll know that you have a software related problem.