Can't rebuild after VM crash

My laptop crashed and with a NixOS VM which was just doing a nixos-rebuild switch.
I can still boot and login to the VM but nixos-rebuild isn’t working anymore.
I get thousand of the following messages.
How could I fix this?

warning: removing corrupted link '/nix/store/.links/1xawr8zy6pfml0gzyh15ayf0lalgv8wqn7br2hqn6aqdya3rqrwp'
warning: removing corrupted link '/nix/store/.links/0d3x0s4mr24y1fcrcjm0w6sra1lbmch03204n8ckdd2a1vxnivvc'

nix-store --verify --check-contents --repair gave me the following error.

error: removing corrupt link '/nix/store/.links/1xawr8zy6pfml0gzyh15ayf0lalgv8wqn7br2hqn6aqdya3rqrwp': Is a directory

nixos-rebuild build --repair returns:

building the system configuration...
error: unrecognised flag '--repair'
Try 'nix --help' for more information

Once this went through once, all errors should be fixed. Then you should be able to do a regular nixos-rebuild switch again.

Doesn’t work and any subsequent try gives me the same error (Is a directory) again.

It worked again after a nix flake update today.
Probably it didn’t need that path anymore.