diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d4b93b5104c1b8c4a56010dd1ca9b676bcbfd4a5..5540d57a867099d4e9fc8fe14131736f1d8c720b 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3670,7 +3670,7 @@ void SubstitutionGoal::tryNext()
     /* Update the total expected download size. */
     auto narInfo = std::dynamic_pointer_cast<const NarInfo>(info);
 
-    maintainExpectedNar = std::make_unique<MaintainCount<uint64_t>>(worker.expectedNarSize, narInfo->narSize);
+    maintainExpectedNar = std::make_unique<MaintainCount<uint64_t>>(worker.expectedNarSize, info->narSize);
 
     maintainExpectedDownload =
         narInfo && narInfo->fileSize