Hash mismatch in downloaded path

It happened on my self host machine when I cached some binary files with nix-serve and copied the caches in a docker container with nix:latest.

I found an issue on the problem. It said you can fix the problem by removing /nix/var/nix/binary-cache-v3.sqlite, but the file isn’t on my server. And I run nix-build in a docker container, so the db file may be new everytime building.

I tried nix-store --delete <nix-store path for that file> and re-build, but the problem is still existed.

I think the problem can be fixed by reset hash db, but I don’t know where it located.

Or is there other method to fix it?

Edit1:
the problem is solved by setting narinfo-cache-positive-ttl to a short time, but I don’t think this is a good way to fix it.

1 Like

See https://nix.dev/faq.html#how-do-i-force-nix-to-re-check-whether-something-exists-at-a-binary-cache

Could you please add an estimate how much time you’ve spent debugging this?

1 Like

Could you please add an estimate how much time you’ve spent debugging this?

Several hours. At first, I ignored narinfo-cache-positive-ttl in the original issue. Because it solved the problem on slave instead of sever. I wanted the one working on server.

See Frequently Asked Questions — nix.dev documentation

Thanks, I found the binary cache db under root’s cache dir.

1 Like

Note that this bug was fixed in Include NAR hash in NAR file name · edolstra/nix-serve@4bbd001 · GitHub