Macbook restarts repeatedly while sleeping Last night, my macbook (10.13.4) was sleeping while low on power. I got on it this morning and the battery was dead. After charging, I noticed that if I close the lid to put the computer to sleep, it will restart over and over again. The same thing happens while I tell the computer to sleep via the menu or terminal with pmset. The restart cycle continues -- the computer will reboot to the login screen, eventually go to sleep, and then reboot about 30 seconds after starting to sleep. There are no visible error messages, but chrome will complain of an improper shutdown if it was open during the last session before sleep.

disk utility says nothing is wrong, I've seen similar issues that suggested removing the sleep image and reseting the pram and smc. The issue persists in safe boot.

If i look at the logs (log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h), when the restart cycle continues I will see entries like:

2018-07-06 11:08:41.767136-0400 0xb1       Default     0x0                  0      0    kernel: (AppleSMC) Previous shutdown cause: -128

Cause -128 looks to be a possible memory or hardware issue from what I can tell. But the apple hardware test does not show any issues. And these are my pmset settings:

~ % pmset -g
System-wide power settings:
Currently in use:
 standbydelay         10800
 standby              0
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             0
 gpuswitch            2
 disksleep            10
 sleep                1 (sleep prevented by AddressBookSourceSync)
 autopoweroffdelay    28800
 hibernatemode        0
 autopoweroff         0
 ttyskeepawake        1
 displaysleep         2
 acwake               0
 lidwake              1
if the issue persist in safe mode,  it means that is either an issue in the whole software or even a problem in the logic board.

to isolate the issue try the next steps:

Create a new user and set the computer to sleep, if issue is not reproduced you can migrate the data from one user to another.

if issue is reproduced and you have a time machine backup to date where everything is fine restore the backup to isolate the problem, if you do not have the backup , try removing the next file :  macintoshHD/library/preferences/powermanagement.plist and perform a PRAM

if you still have the problem, backup your files and erase and install

if you still have the problem, you will have to take it to service. if it is hardware it is normally the logic board the problem.

good luck