Error: --- InvalidPath --- nix-env

Two days ago these messages started showing up when I’m trying to update my Nix user profile.

building '/nix/store/'...
error: --- InvalidPath --- nix-env
path '/nix/store/95g0dn9vv60f8yargd9prfn5cqg91f6h-aws-checksums-0.1.7' is not valid

Why is this happening?

Admittedly, the installation is a bit adventurous. Nix is running inside nix-user-chroot, patched with the attribute patch and the SQLite patch for NFS.

Turns out that this was caused by some filesystem issues. I deleted and redownloaded the offending store path, but the bottom line is that putting the Nix store on an NFS volume is not a good idea, because after fixing this one I also found that the SQLite database was corrupted. After wasting some time on trying to fix it manually I decided to just reinstall Nix on local storage.