Repository: iterative/dvc

Issue:
fetch: silently fails to download files from 2.0 remote
https://stackoverflow.com/questions/76675501/problem-in-downloading-audio-transcription-datasets

Can reproduce as well.


Discussion:
Looks like the issue is the lack of default remote set. Once you set it - it works fine.  Looking at improving the error...
Looks like this is not new and has been happening with 2.0 for a very long time, but no one noticed. Looking at introducing some kind of check to error out.
> Looks like this is not new and has been happening with 2.0 for a very long time, but no one noticed. Looking at introducing some kind of check to error out.

Do you mean for `fetch` specificially? For `pull`, I'm seeing an error until https://github.com/iterative/dvc/commit/78637713cfd3cef754e17e6743a1050cd0eafa8e. Before that, I get:

```console
$ git clone https://dagshub.com/mert.bozkirr/CREMA-D.git
$ cd CREMA-D
$ dvc fetch
Everything is up to date.
$ dvc pull
WARNING: No file hash info found for '/private/tmp/CREMA-D/VideoFlash'. It won't be created.
WARNING: No file hash info found for '/private/tmp/CREMA-D/AudioWAV'. It won't be created.
WARNING: No file hash info found for '/private/tmp/CREMA-D/Metadata-and-Results'. It won't be created.
WARNING: No file hash info found for '/private/tmp/CREMA-D/AudioMP3'. It won't be created.
4 files failed
ERROR: failed to pull data from the cloud - Checkout failed for following targets:
/private/tmp/CREMA-D/VideoFlash
/private/tmp/CREMA-D/AudioWAV
/private/tmp/CREMA-D/Metadata-and-Results
/private/tmp/CREMA-D/AudioMP3
Is your cache up to date?
<https://error.dvc.org/missing-files>
```

After it, I get different results for `pull`:

```console
$ dvc pull
A       AudioWAV/
A       Metadata-and-Results/
A       AudioMP3/
A       VideoFlash/
4 files added
```

@dberenbaum Yeah,I was focused on `fetch` there. Indeed, `checkout` is more relevant there. I'll do that first then.
Failing on `fetch` also seems needed here though and would fail further upstream, which would be nice.
@efiop This one still appears to be broken.
Ok, so this is about checkout ignoring DataIndexTreeError during comparison stage and thus thinking that it just needs to create empty dirs, while what we really need is error-out. I think  the proper solution here is to not ignore that exception (at least for the `new` index). Looking into it.
Keeping open to double check the ui. Not liking that `Everything is up to date` message in pull, it wasn't there before.

But functionally should be fixed now.
@efiop, what's up with this? Can i help you in any way on this? 
@skshetry Functially fixed, wanted to maybe revisit the ui, but I think I'll just close this for now and we can get back to that later.
What is the ui issue? Could you please elaborate for the record?
@skshetry 

```
(dvc-3.11.2-debug) ➜  CREMA-D git:(master) dvc pull
Everything is up to date.
ERROR: failed to pull data from the cloud - Checkout failed for following targets:
AudioMP3
AudioWAV
Metadata-and-Results
VideoFlash
Is your cache up to date?
<https://error.dvc.org/missing-files>
```

Don't quite like that `Everything is up to date` when there is no default remote set.
I think you were right to leave it open then @efiop. Feels too confusing to leave like that for long.
I guess generally it is hard for us to detect if this is intended or not, because you might not have a default remote set, but have per-output remotes or you just don't have default remote set and that's inteded behaviour (e.g. you care about imports and that's all). I think the best we can do here is just throw a warning saying that "hey, you don't have any default remote set" or smth like that if we weren't able to transfer anything. So you'd get the warning and the rest of the output will be the same as illustrated above.
So in this case `Everything is up to date.` means that fetch was successful because nothing was expected to be fetched? Can we indicate that it comes from the fetch step somehow (and show that the rest comes from the checkout step) to make the messaging less confusing? 

> I think the best we can do here is just throw a warning saying that "hey, you don't have any default remote set" or smth like that if we weren't able to transfer anything.

👍 During fetch, can we show a warning if no remote is explicitly provided and no default remote is set?

Resolving patch:
diff --git a/dvc/commands/data_sync.py b/dvc/commands/data_sync.py
--- a/dvc/commands/data_sync.py
+++ b/dvc/commands/data_sync.py
@@ -14,6 +14,10 @@ def log_summary(self, stats):
         from dvc.utils.humanize import get_summary
 
         default_msg = "Everything is up to date."
+
+        if not self.args.remote and not self.repo.config["core"].get("remote"):
+            ui.warn("No remote provided and no default remote set.")
+
         ui.write(get_summary(stats.items()) or default_msg)
 
 


Test patch: