diff options
-rw-r--r-- | src/nix/installables.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc index 6b9e2ee96..c2e2a6573 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -339,12 +339,14 @@ std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableF auto aDrvPath = attr->getAttr(state->sDrvPath); auto drvPath = state->store->parseStorePath(aDrvPath->getString()); - if (!state->store->isValidPath(drvPath)) { + if (!state->store->isValidPath(drvPath) && !settings.readOnlyMode) { /* The eval cache contains 'drvPath', but the actual path has been garbage-collected. So force it to be regenerated. */ aDrvPath->forceValue(); - assert(state->store->isValidPath(drvPath)); + if (!state->store->isValidPath(drvPath)) + throw Error("don't know how to recreate store derivation '%s'!", + state->store->printStorePath(drvPath)); } auto drvInfo = DerivationInfo{ |