Sometimes when I open Emacs, Emacs initialization fail.
That is because .emacs or init.el files have a bug. (My bugs often come from just misty
I've had great success with elisp bug hunter https://github.com/Malabarba/elisp-bug-hunter.
The most common problems are unmatched parenthesis, loading-failed packages.:
Automated error hunting
If your Emacs init file signals an error during startup, but you don’t know why, simply issue
M-x bug-hunter-init-file RET eand The Bug Hunter will find it for you. Note that your init.el (or .emacs) must be idempotent for this to work.
Interactive hunt
If Emacs starts up without errors but something is not working as it should, invoke the same command, but choose the interactive option:
M-x bug-hunter-init-file RET iThe Bug Hunter will start a separate Emacs instance several times, and then it will ask you each time whether that instance presented the problem you have. After doing this about 5–12 times, you’ll be given the results.