I am on a fresh install of emacs 26.3, and I have the following in my init.el:

(require 'package)
(add-to-list 'package-archives
             '("melpa", "http://melpa.org/packages/") t)

When I go to refresh the package list (M-x package-refresh-contents) I encounter the following error:

  string-match("\\`https?:" ((\, "http://melpa.org/packages/")) nil)
  package--download-one-archive(("melpa" (\, "http://melpa.org/packages/")) "archive-contents" t)
  funcall-interactively(package-list-packages nil)
  call-interactively(package-list-packages record nil)
  command-execute(package-list-packages record)
  execute-extended-command(nil "package-list-packages" "package-lis")
  funcall-interactively(execute-extended-command nil "package-list-packages" "package-lis")
  call-interactively(execute-extended-command nil nil)

What is happening and why doesn't this work? I have seen some chatter on related issues that

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

before (package-initialize) should resolve this issue, but it doesn't.

1 Answer 1


The error seems to be saying that ((\, "http://melpa.org/packages/")) doesn't match the regex


Let's look at that value, the one being added to package-archives:

'("melpa", "http://melpa.org/packages/")

If we put this into IELM, let's see what we get:

ELISP> '("melpa", "http://melpa.org/packages/")
 (\, "http://melpa.org/packages/"))

Oh! This is not what we expect! The cdr of this list is a proper list (we want a string), and that has a comma as the first character.

What happened here? What is each element of package-archives supposed to be?

package-archives is a variable defined in ‘package.el’.

Each element has the form (ID . LOCATION).

A period instead of a comma makes this a single cons cell, and not a proper list. The proper code is:

(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
  • 1
    Thank you, correct syntax is good to have :/
    – learner
    Commented Nov 11, 2019 at 23:19

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.