Error: don't know how to recreate store derivation

When building a derivation I get the message:
error: don't know how to recreate store derivation

What’s going on?

Can you paste the derivation code itself? I have a suspicion the problem is that you’re referring to a nix store path directly in your nix code, but that’s just a guess.

Yes, sure. The derivation code is here It’s quite obscure and imports a few other projects which is why I didn’t post it initially.

Changing the hash of the derivation by modifying one of the input files slightly fixed the issue. The issue originally arose after doing a nix-collect-garbage.

Hmm. Then you may have gotten your nix store and nix db out of date somehow. That normally will only happen if you manually alter the nix store (which you should never do), but if it happened anyway, that could be indicative of a bug in nix.

(The surrounding lines of context of the error might help, too.)

I think this is most likely what happened (as I did not manually alter the nix store). Unfortunately after finding this workaround and progressing with the project I’m no longer able to reproduce the error.

Thanks for the comments though :slight_smile: I thought I’d open a thread in case others experience a similar issue.

Have the same issue, and it happened because I ran cleaning commands while doing a rebuild-switch (wasn’t on purpose :sweat_smile:)

1 Like