6.5 Why does Emacs say ‘Error in init file’?

An error occurred while loading either your init file or the system-wide file site-lisp/default.el. Emacs pops the *Messages* buffer, and puts there some additional information about the error, to provide some hints for debugging.

For information on how to debug your init file, see How do I debug an init file?.

It may be the case that you need to load some package first, or use a hook that will be evaluated after the package is loaded. A common case of this is explained in Why doesn’t this [terminal or window-system setup] code work in my init file, but it works just fine after Emacs starts up?.