1

I'm having a very basic problem with getting my emacs to talk to the GNU package repository.

The contents of my .emacs are

(require 'package)
(package-initialize)
(package-refresh-contents)

When I start up emacs, I see

Contacting host: elpa.gnu.org:443
Package refresh done
Failed to download ‘gnu’ archive.

When I do M-x toggle-debug-on-error and then M-x package-refresh-contents, I get the following stacktrace:

Debugger entered--Lisp error: (file-error "https://elpa.gnu.org/packages/archive-contents" "Bad Request")
  signal(file-error ("https://elpa.gnu.org/packages/archive-contents" "Bad Request"))
  package--download-one-archive(("gnu" . "https://elpa.gnu.org/packages/") "archive-contents" nil)
  package--download-and-read-archives(nil)
  package-refresh-contents()
  funcall-interactively(package-refresh-contents)
  call-interactively(package-refresh-contents record nil)
  command-execute(package-refresh-contents record)
  execute-extended-command(nil "package-refresh-contents" "package-refre")
  funcall-interactively(execute-extended-command nil "package-refresh-contents" "package-refre")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I originally was trying to connect to Melpa, but I saw I have this issue even working with just the GNU archive. I'm on Emacs 26.2, macOS 10.14.6.

Any ideas?

1 Answers1

2

I believe that Emacs 26.3 fixes this.

You should upgrade (26.2 to 26.3 is a very minor update; nothing should break); but if you genuinely cannot do that for some reason, then this might do the trick for you:

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

You could also consider installing 27.1, which is the latest release.

phils
  • 48,657
  • 3
  • 76
  • 115