8

All of a sudden Emacs returns an error at the startup, when I run $ emacs --debug-init from the terminal (linux) I get this debug error message:

Debugger entered--Lisp error: (wrong-type-argument listp <!DOCTYPE)
  package--read-archive-file("archives/gnu/archive-contents")
  package-read-archive-contents("gnu")
  package-read-all-archive-contents()
  package-initialize()
  eval-buffer(#<buffer  *load*> nil "/home/ffs/.emacs.d/init.el" nil t)  ; Reading at buffer position 136
  load-with-code-conversion("/home/ffs/.emacs.d/init.el" "/home/ffs/.emacs.d/init.el" t t)
  load("/home/ffs/.emacs.d/init" t t)
  #[0 "\205\266 \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337\"\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.emacs'" "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7]()
  command-line()
  normal-top-level()

What I suspect is the first lines of my init.el which has the following start:

(require 'package)
(package-initialize)
(require some_pakagename)
...

when I evaluate the line of (package-initialize) C-x C-e from inside the init.el file I get this error:

package-read-archive-contents: Wrong type argument: listp, <!DOCTYPE

I get the same error when I try doing M-x list-packages from the mini-buffer.

So, please could you help me spot the source of error?

4
  • 3
    Seems like packages server replied to a request once with some HTTP error formatted as an HTML page. Look into ~/.emacs.d/elpa/archives/gnu/achive-contents file, if you are curious to find out what the error was. I'm not 100% sure it's OK to just delete this file, but given your circumstances, this sounds like the way to go (the file isn't useful anyway).
    – wvxvw
    Jan 16, 2016 at 11:03
  • Ok, I removed it after keeping a backup of this file, and everything works like expected, but I am left clueless now as to whether I broke something else by deleting this file, any idea?
    – doctorate
    Jan 16, 2016 at 11:41
  • Well, this file describes what packages are available for download from GNU packages server. Normally, if the network is functioning properly you should be able to re-download the file. The reasons to fear could be for example, if somehow the version of the packages that you used before wouldn't match this file or something like that. But, since you say it seems to work, I'd not bother about it.
    – wvxvw
    Jan 16, 2016 at 12:18
  • 1
    Great!, please feel free to upgrade your comments to an answer for future reference.
    – doctorate
    Jan 16, 2016 at 13:30

1 Answer 1

9

The "misbehaving" file ~/.emacs.d/elpa/archives/gnu/archive-contents was most likely overwritten by HTML content of a page reporting a connection error. It should be safe to remove it. Emacs will fetch this file again upon calling (package-initialize)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.