PS: Steps to reproduce...
1. run $ sudo pacman -Sc Everything should still be fine. 2. run $ sudo pacman -U https://ftp.sh.cvut.cz/arch/core-testing/os/x86_64/linux{,-docs,-headers}-6.18.2.arch2-1-x86_64.pkg.tar.zst 3. After that... $ sudo pacman -Sc Packages to keep: All locally installed packages Cache directory: /var/cache/pacman/pkg/ :: Do you want to remove all other packages from cache? [Y/n] removing old packages from cache... error: could not open file /var/cache/pacman/pkg/download-1HaVIU: Error reading fd 7 Database directory: /var/lib/pacman/ :: Do you want to remove unused repositories? [Y/n] removing unused sync repositories... In other words, it is a problem with pacman -U. $ sudo rmdir /var/cache/pacman/pkg/download-1HaVIU $ sudo pacman -Sc Packages to keep: All locally installed packages Cache directory: /var/cache/pacman/pkg/ :: Do you want to remove all other packages from cache? [Y/n] removing old packages from cache... Database directory: /var/lib/pacman/ :: Do you want to remove unused repositories? [Y/n] removing unused sync repositories...
