2016 MacBook Pro shutdowns when the lid is close with cause 0 My 15-inch 2016 MacBook Pro is now experiencing shutdowns when the lid is closed. Though it is not a crash because I don't get a crash report when I turn the computer back on (unlike the problem I had earlier). I used the following Terminal command to obtain the Previous Shutdown Cause (as the console app can't do it anymore in Sierra):

log show --style syslog --last 48h | egrep shutdown\ cause | awk -F')' '{print substr($0,1,19), $NF}'


The code for the shutdown is 0. From this question I found that 0 triggers when you unplugged the battery, or the power cable on desktop Macs. But the battery on the 2016 MacBook Pro is non-removable (obviously). Even more strangely, when this happens, my laptop is plugged into the power adapter and for sure it is charging. This doesn't happen when I am using the computer both on battery and power adapter, it only happens when the lid is closed for a while.

I have tried to reset SMC and NVRAM with no luck. Anyone know how to solve this problem?
Possible hardware issues aside, check what is your setting on what the computer wants to do when you close the lid and the behaviour afterwards. You can see the settings with the:

pmset -g


Look for the hibernatemode, autopoweroffdelay and standbydelay settings.

See a blog post describing the pmset settings here

On the hardware problems side I've read reports that a faulty charger might cause the MacBook to shutdown. As you report that the problem does not occur when on battery life, this may be the culprit and I'd suggest you try a different charger.

Is the time you mention "for a while" three hours or more? Then the problem occurs when your MacBook tries to enter the standby (see standbydelay setting above).