projectile icon indicating copy to clipboard operation
projectile copied to clipboard

Wrong type argument: listp, nil/Projects/builds/emacs-git/src/emacs-git/

Open Hi-Angel opened this issue 8 months ago • 3 comments

I am a light projectile-user, so figured I'd report this here in case it may come up for other people as well.

Today after I forcefully closed my KDE session (was testing an effects plugin), which included my Emacs, and then started Emacs back I started getting an error:

Wrong type argument: listp, nil/Projects/builds/emacs-git/src/emacs-git/

I tried updating projectile, but the only difference I got is that before update the error was happening during (projectile-mode 1), whereas now it's upon opening a file under projectile control.

Turning on backtrace gives this output:

Debugger entered--Lisp error: (wrong-type-argument listp nil/Projects/builds/emacs-git/src/emacs-git/)
  cl-remove(nil ("~/Projects/kwin/" . nil/Projects/builds/emacs-git/src/emacs-git/) :if #f(compiled-function (x) #<bytecode 0x116b183d0f88c66b>))
  cl-remove-if(#f(compiled-function (x) #<bytecode 0x116b183d0f88c66b>) ("~/Projects/kwin/" . nil/Projects/builds/emacs-git/src/emacs-git/))
  projectile-difference(("~/Projects/kwin/" . nil/Projects/builds/emacs-git/src/emacs-git/) nil)
  projectile-merge-known-projects()
  projectile-add-known-project("/home/constantine/Projects/kwin/")
  projectile-track-known-projects-find-file-hook()
  projectile-find-file-hook-function()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer main.js> "~/Projects/kwin/src/plugins/fadedesktop/package/contents/code/main.js" nil nil "~/Projects/kwin/src/plugins/fadedesktop/package/contents/code/main.js" (44814766 27))
  find-file-noselect("/home/constantine/Projects/kwin/src/plugins/fadedesktop/package/contents/code/main.js" nil nil)
  ido-file-internal(raise-frame)
  ido-find-file()
  funcall-interactively(ido-find-file)
  call-interactively(ido-find-file nil nil)
  command-execute(ido-find-file)

Hi-Angel avatar Mar 23 '25 20:03 Hi-Angel

By searching in ~/.emacs.d I found what causes it (although it doesn't reveal what resulted in that in the first place).

File ~/.emacs.d/projectile-bookmarks.eld has an ELisp list which starts with nil/Projects/builds/emacs-git/src/emacs-git/". So, like, nil/Projects/builds/emacs-git/src/emacs-git/" "some/other/project" "some/3rd/project").

Basically, the start of the file lacks parentheses and double quotes and in place of a tilde sign there's a nil for some reason. Replacing it as

@@ -1,1 +1,1 @@
-nil/Projects/builds/emacs-git/src/emacs-git/"
+("~/Projects/builds/emacs-git/src/emacs-git/"

and restarting Emacs fixes the problem.

Hi-Angel avatar Mar 24 '25 07:03 Hi-Angel

Seems like some cache serialization issue, but I'm not sure what might have caused it, as the logic there hasn't been changed in a long time.

bbatsov avatar Mar 24 '25 07:03 bbatsov

the logic there hasn't been changed in a long time.

Yeah, I don't think it's a regression, this seems more likely some corner case when Emacs isn't being closed cleanly.

Hi-Angel avatar Mar 24 '25 07:03 Hi-Angel