diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 9d7867cdc..14a8669b3 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -754,7 +754,11 @@ func removeExistingChain(cctx *cli.Context, lr repo.Repo) error { return xerrors.Errorf("error locking repo: %w", err) } // Ensure that lockedRepo is closed when this function exits - defer lockedRepo.Close() + defer func() { + if closeErr := lockedRepo.Close(); closeErr != nil { + log.Errorf("Error closing the lockedRepo: %v", closeErr) + } + }() cfg, err := lockedRepo.Config() if err != nil {