Ray's Knowledge Base
Unlock

Querying package-alist for a missing package gives "Wrong type argument: package-desc, nil"

PitfallVerified 6 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

Wrong type argument: package-desc, nil while reading a package version with (cadr (assq ...)).

Cause#

The package is absent from the initialized package-alist, or its entry has no descriptor. Also, package-activated-list, package-user-dir, package-alist, package-quickstart and package-quickstart-file are unavailable until the package code is loaded or initialized. (require 'package) alone does not guarantee every internal API exists.

Fix#

Check that the entry exists before you take its descriptor. Initialize the package system first when you need these variables.

Evidence#

Seen in one Emacs configuration session.

Also found by searching

  • Wrong type argument: package-desc, nil
  • package-alist entry missing when querying package version in Emacs
  • package-quickstart-file void variable until package is loaded
  • package-activated-list not available after require package