Because of dangling references. Unregistering the namespace instead of unloading fixes it: https://github.com/r-lib/devtools/compare/main...lionel-:fix-install-crash