Store path starts with illegal character '.'

I updated my system today to Nix 2.18.2 (nixpkgs commit 20f77aa09916374aa3141cbc605c955626762c9a) and getting nix store errors all over the place because one of my home-manager home.files contained a source with a filename which is hidden (i.e. prefixed with a dot).

Does anybody know why this is suddenly a problem?
I renamed the offending source path and now I am struggeling to remove the offending store path which is no longer in use. nix-store --delete, nix-collect-garbage and the like all complain with:

error: store path 'wk4ylz2adn2i5hrhc6rq7bsllfazs5nw-.streamdeck_ui.json' starts with illegal character '.'

1 Like

This was actually a fix of a regression against an even older version of Nix: StorePath: reject names starting with '.' by edef1c · Pull Request #9095 · NixOS/nix · GitHub

It was deliberately re-introduced starting with 2.19: #912 allow leading period by roberth · Pull Request #9867 · NixOS/nix · GitHub

Thanks for pointing me at the relevant PR @fricklerhandwerk! That is exactly what I was looking for.
Unfortunately, reading through the PR and the discussions, I do not understand how to deal with the issue. The nix maintainers meeting protocol says: “No real solution except allowing them internally (just forbid creating new ones)”

However, it seems that they are not allowed internally, are they?

I ran into this on NixOS unstable as well recently, my workaround was to set nix.package = pkgs.nixVersions.unstable;, nixos-rebuild, and run the GC again.

6 Likes

Thanks so much! The temporary switch to nix unstable solved my issue.

Wanted to thank you, this was the solution that finally ended hours of torment scowering the docs.

For anyone who’s encountering this same issue in the future, two notes–

  1. pkgs.nixVersions.unstable has been replaced by pkgs.nixVersions.git. Setting nix.package works the same as raboof’s original post.
  2. after running nix-collect-garbage on the switched configuration targetting nixVersions.git, if the error still persists, try nix-store --verify. This command was the one that managed to recognize the missing file and remove the broken store path from the database, thus solving the problem for good.
2 Likes

Hi, i’m quite new to nixos and managed to fill up my whole disk to the last byte and now I can’t run gc because of this error and i can’t clean up anything more, and because the disk is full i can’t upgrade to the git branch.

suggestions are welcome, thx