After entering password Mac shuts down

I am using MacBook Air 13" with macOS Sierra.

I am facing with this problem for the first time, never had any issues with my MacBook before for almost 3 years.

I turned on my MacBook, picked my user, entered password and progress bar started loading, it filled for about 3/4 and laptop shut down. This happens every time I try to login into my user. However, I am able to login as a Guest.

I turned it on with Cmd + S buttons and saw a message :
BuildError(): error building a user of type 0x20010008


Question:
I am hoping this is not a hardware issue. If it is a software issue I have no problems reinstalling my macOS, but how do I save all my data/files that I have? (I am not using TimeMachine)


Okay, so after some searching/googling I found that all problems that I had was because of FileVault bug that makes your OS pause/freeze at login.

This FileVault bug first was seen on Mac OS X Yosemite, I do not know why I faced with this issue on macOS Sierra, which must work perfectly, but nvm, here is my solution.


Solutions

(Works if your FileVault is turned ON, if not, it may be hardware issue)

When you supply a password for your account at login screen your OS starts to unlock the disk. Unfortunately in some cases this process seems to be hindered by some bug with FileVault 2 setups that prevents their systems from immediately unlocking and loading the OS, so their systems now take up to several minutes to log in, or fail to log in as in my case.

Solution 1 - If your OS loads for a long time

Ensure you have a full backup of your Mac using Time Machine.

  • Go to FileVault tab in the Security & Privacy system preferences and turn off FileVault.

  • When FileVault is disabled and your drive is decrypted, restart your Mac.

  • Hold the Command-R keys down at the boot chimes to load your Mac into Recovery Mode.

  • Open Disk Utility and use it to run a Repair Disk routine, available in the First Aid tab when you select your hard drive. Do this for both the hard drive device, and your boot volume.

  • Restart your Mac normally and log in.

  • Re-enable FileVault in the Security & Privacy system preferences.

Solution 2 - If you can't login and stuck watching progress bar loading forever

The above routine works for if you can eventually boot your Mac in the face of this bug, but if you cannot log in and see the system hang on the loading progress bar for hours with no ability to use your system, then you will have to use another procedure:

  • Reboot your system and hold the Command-R keys at the startup chimes to load into Recovery Mode.

  • Use Disk Utility to turn off encryption on your boot drive. If this gives you errors, then reboot in Target Disk Mode (hold the T key at the boot chimes) and use Disk Utility on another Mac via a Thunderbolt or Firewire cable to turn off encryption. Alternatively, you can try booting to Internet Recovery by holding Option-Command-R at the boot chimes, which will avoid using your internal drive for any boot purposes.

  • With your drive unlocked and decrypted, use Disk Utility to verify and repair your boot drive.

  • Restart your Mac normally.

  • Use the Security & Privacy system preferences to re-enable FileVault.