risicle / nix-heuristic-gc

A more discerning cousin of nix-collect-garbage
GNU Lesser General Public License v2.1
57 stars 1 forks source link

RuntimeError: error: '...' is too short to be a valid store path #4

Closed lrworth closed 1 year ago

lrworth commented 1 year ago

I just tried running nix-heuristic-gc for the first time and it didn't work:

$ nix run --no-write-lock-file github:risicle/nix-heuristic-gc/e4cbca1a79a437681717377f756a491eedf4013f -- 8GB
warning: not writing modified lock file of flake 'github:risicle/nix-heuristic-gc/e4cbca1a79a437681717377f756a491eedf4013f':
• Added input 'flake-utils':
    'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Added input 'nixpkgs':
    'github:NixOS/nixpkgs/7dc71aef32e8faf065cb171700792cf8a65c152d' (2023-05-20)
2023-05-22 09:29:07,183:INFO:nix_heuristic_gc.graph: querying dead paths
finding garbage collector roots...

...

determining live/dead paths...
deleting '/nix/store/add-27743-0'
deleting '/nix/store/add-14032-0'
deleting '/nix/store/add-43185-0'
Traceback (most recent call last):
  File "/nix/store/g0rcpkl8s2f28mpxp7xp6sgfviy54sc5-python3.10-nix-heuristic-gc-0.4.0/bin/.nix-heuristic-gc-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/g0rcpkl8s2f28mpxp7xp6sgfviy54sc5-python3.10-nix-heuristic-gc-0.4.0/lib/python3.10/site-packages/nix_heuristic_gc/__main__.py", line 184, in main
    nix_heuristic_gc(**parsed)
  File "/nix/store/g0rcpkl8s2f28mpxp7xp6sgfviy54sc5-python3.10-nix-heuristic-gc-0.4.0/lib/python3.10/site-packages/nix_heuristic_gc/__init__.py", line 49, in nix_heuristic_gc
    garbage_graph = GarbageGraph(
  File "/nix/store/g0rcpkl8s2f28mpxp7xp6sgfviy54sc5-python3.10-nix-heuristic-gc-0.4.0/lib/python3.10/site-packages/nix_heuristic_gc/graph.py", line 155, in __init__
    garbage_store_path_set = {
  File "/nix/store/g0rcpkl8s2f28mpxp7xp6sgfviy54sc5-python3.10-nix-heuristic-gc-0.4.0/lib/python3.10/site-packages/nix_heuristic_gc/graph.py", line 156, in <setcomp>
    libstore.StorePath(path_split(str(p))[1]) for p in garbage_path_set
RuntimeError: error: 'add-14032-0' is too short to be a valid store path
$ nix --version
nix (Nix) 2.11.1
risicle commented 1 year ago

That's... interesting.

What are /nix/store/add-27743-0 et al, and how did they come to be in your store?

risicle commented 1 year ago

I can handle this, but only by writing some tests, which is something I've put off so far...

risicle commented 1 year ago

Should be fixed by 23f0660ff65e5050d235744a4eaaaeeaec4f4616. Please reopen if you continue to have problems.