8

I am on this version of GNU Emacs on a Windows 10 computer: GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29

For the past many weeks, Emacs report this error accessing GNU Elpa when I run "list-packages":

Importing package-keyring.gpg...done
error in process filter: Error retrieving: https://elpa.gnu.org/packages/archive-contents (error http 400) [2 times]
Package refresh done

In a browser, I can access the URI just fine. This happens on two Windows 10 boxes I have.

A Google shows complaints about such errors as recently as a year ago, though I've not found any with "http 400 (Bad Request)". In addition, I don't have errors for melpa stable, the other repository in my package-archives list:

 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa-stable" . "https://stable.melpa.org/packages/"))))

Does one of you have suggestions on what else I might try?

Thanks, Mario

2
  • Do you get the same errors when trying to access HTTPS content in Emacs generally? Try out with M-x eww and surfing something like ix.de.
    – wasamasa
    Sep 9 '20 at 6:55
  • Thank you for the question and suggestion. I do not get errors with the MELPA URL: stable.melpa.org/packages. When I use eww with that URI, I do not get errors, but I do get redirected. When I use eww with elpa.gnu.org/packages/archive-contents, I get a 400 Bad Request: "Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port." Same for your URL. And although when I accesss the "http://" version, eww can visit the page, list-packages still complains with a "404 error in process filter".
    – mobatemacs
    Sep 10 '20 at 13:49
9

try this out : (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") reference: https://www.reddit.com/r/emacs/comments/cdei4p/failed_to_download_gnu_archive_bad_request/etw48ux/?utm_source=share&utm_medium=web2x

Explanation: It is a race bug int Emacs and newer versions of GNU TLS that showed up in Emacs v26.1 but is fixed in Emacs v27. A simple temporary fix is just to turn of TLS 1.3 support in Emacs v26.1 and the race conditions goes away. It is not a good solution, as we need TLS 3.1, but it will do until the propper sollution is implemented. As discussed in the original bug report. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341#19

4
  • Please try to explain why/how it works in the answer instead to providing only a link.
    – Muihlinn
    Dec 17 '20 at 8:43
  • It remove the TLS1.3 version of encryption from allowed encryptions between client (emacs) and the server when it set up the https-connection. I believe.
    – Anders
    Dec 28 '20 at 7:42
  • I have now read the original bug report, and yes. It is a race bug in TLS library. And by turning of TLS 1.3, it will not show. It is fixed in later versions of Emacs (v 27). Here are the actually bug that explain what happens. debbugs.gnu.org/cgi/bugreport.cgi?bug=34341#19
    – Anders
    Dec 28 '20 at 7:55
  • 1
    Similar issue still exist for v27 for certain platforms, i.e. NetBSD - debbugs.gnu.org/cgi/bugreport.cgi?bug=48103 I think this is the same issue I'm encountering with v27 on MacOS, and it can be also resolved with gnutls-algorithm-priority.
    – hshib
    Jun 14 at 20:26
1

This is most likely your Emacs not having working TLS support. Make sure your Emacs has been built with GnuTLS support (this should be on by default, check with M-: (string-match-p "GNUTLS" system-configuration-features)) and that the GnuTLS libraries are available in the expected location. The easiest way of doing the latter on Windows is installing a version that includes the dependencies, check https://ftp.gnu.org/gnu/emacs/windows/ for the relevant downloads.

8
  • Thank you for this suggestion. In this case, I do have GNUTLS. In fact, the value of system-configuration-features is "XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2". Could it be something else? My Emacs is not directly from GNU but rather is Vincent Goulet's packaging of the GNU release (see vigou3.gitlab.io/emacs-modified-windows/.)
    – mobatemacs
    Sep 11 '20 at 19:26
  • Yes, that leaves the DLL files. Try the dependencies-included official version.
    – wasamasa
    Sep 11 '20 at 22:20
  • Thank you. I did as you suggested and downloaded and installed the dependencies-included version of Emacs from here: mirror.team-cymru.com/gnu/emacs/windows/emacs-26/…. Unfortunately, I still get the original error message when I list packages, and I also get the Bad Request error when I access GNU Elpa using eww: elpa.gnu.org/packages/archive-contents. Do you have any other suggestions for what I could try?
    – mobatemacs
    Sep 13 '20 at 14:22
  • I've downloaded that Emacs release, unpacked it, started bin/runemacs.exe and successfully opened M-x eww with elpa.gnu.org/packages/archive-contents. No errors here.
    – wasamasa
    Sep 14 '20 at 8:22
  • I re-downloaded Emacs 26.3 to verify that it does show the error with that URL. I also downloaded Emacs 27.1 and saw it did not show the error with that URL. This is strange.
    – mobatemacs
    Sep 15 '20 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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