Fork me on GitHub
#emacs
<
2023-02-02
>
pesterhazy09:02:31

I need help debugging an issue that's been plaguing my emacs config for years. Whenever I install a new package with package-install I get an error message:

signal(wrong-type-argument (stringp (require . package)))
Here's the backtrace: https://gist.github.com/pesterhazy/0612322028ef92d109769616cf80b661

pesterhazy09:02:38

I think it's probably some configuration setting or package that I've installed that's somehow interfering with the functioning of package-install, but I'm having a hard time parsing the backtrace

pesterhazy09:02:45

AIUI the exception (I think that's what signal means here?) occurs in a byte-complied package, package.el

pesterhazy09:02:55

(That's why, sadly, there are no line numbers here)

pesterhazy09:02:35

Something is expected to be a string, but isn't

pesterhazy09:02:45

But I don't know what

(require . package)
means

pesterhazy09:02:20

Is that "dotted pair notation" for cons cells? What does that have to do with anything??

pesterhazy09:02:27

In any case, the problem appears to be in the function

package--with-response-buffer-1
which processes a response from the server, presumably the package coming back from elpa. But my understanding ends there. I don't see any calls to require in that fn

pesterhazy09:02:00

I just tried with a near-empty init.el, and the error still appears!

mpenet09:02:29

which version of emacs?

pesterhazy09:02:05

But I swear I've seen this in older versions as well, as far back as a couple of years ago

pesterhazy09:02:52

Hm, I just saw that package-refresh-contents also fails

Contacting host: 
Package refresh done
Failed to download 'melpa' archive.

pesterhazy09:02:20

This is all of my init.el

(require 'package)
(add-to-list 'package-archives '("melpa" . "") t)
(package-initialize)

mpenet09:02:45

maybe some emacs update that re-uses some outdated code from the load-path or something

mpenet09:02:13

difficult to say, but that smells like something that could happen

pesterhazy09:02:27

Is there some cache I could delete?

mpenet09:02:14

I would say reinstall emacs

pesterhazy09:02:29

Aha, now it feels like I'm getting somwhere. I deleted .emacs.d, now it seems to be working

mpenet09:02:36

and ensure you don't have anything in previous locations of the current load-path

mpenet09:02:47

before you reinstall

pesterhazy09:02:48

Something about my .emacs.d must be causing this

mpenet09:02:12

did you try to load emacs without loading the conf at all and just eval the code you mentioned?

elken09:02:26

Probably something erroneous in custom.el

pesterhazy09:02:49

let met try emacs -Q

pesterhazy10:02:50

OK so it works with -Q, but breaks without -Q

mpenet10:02:09

you can try to reduce the scope by trying no-site-list and no-site-file

mpenet10:02:25

-Q combines these 2 and others

pesterhazy10:02:27

Ok, great suggestion. So it really is --no-init-file

pesterhazy10:02:58

The crazy thing is this happens even if the init.el is empty

pesterhazy10:02:28

I distilled it down to installing a package from GNU elpa, so I don't even have to add MELPA to repro the problem

elken10:02:01

> Probably something erroneous in custom.el

pesterhazy10:02:17

but I don't have a custom.el - maybe I'm not understanding?

pesterhazy10:02:27

I just started from a completely empty .emacs.d

elken10:02:46

No idea then

pesterhazy10:02:37

It also works if I delete .emacs.d/elpa before installing stuff

pesterhazy10:02:58

OK here's a description of the error, and the workaround described fixes the problem https://www.reddit.com/r/emacs/comments/flb0vc/comment/g13izoy/

pesterhazy10:02:56

So the problem seems to be with certain macos builds of emacs. I upgraded to the latest Emacsformacos build 28.2 and that also seems to fix the issue, no editing up loadup.el necessary

pesterhazy10:02:07

But wow, what a weird problem

pesterhazy10:02:19

Thanks for the help @U043RSZ25HQ @U050SC7SV

🙌 4