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.

Resolving patch:
diff --git a/dvc/repo/checkout.py b/dvc/repo/checkout.py
--- a/dvc/repo/checkout.py
+++ b/dvc/repo/checkout.py
@@ -51,20 +51,16 @@ def _build_out_changes(index, changes):
         out_keys.append(key)
 
     out_changes = {}
-    for objects in changes.values():
-        for change in objects:
-            for out_key in out_keys:
-                if (
-                    len(out_key) > len(change.key)
-                    or change.key[: len(out_key)] != out_key
-                ):
-                    continue
-
-                if change.key == out_key:
-                    out_changes[out_key] = change.typ
-                elif not out_changes.get(out_key):
-                    out_changes[out_key] = MODIFY
-                break
+    for key, change in changes.items():
+        for out_key in out_keys:
+            if len(out_key) > len(key) or key[: len(out_key)] != out_key:
+                continue
+
+            if key == out_key:
+                out_changes[out_key] = change.typ
+            elif not out_changes.get(out_key):
+                out_changes[out_key] = MODIFY
+            break
 
     return out_changes
 
diff --git a/dvc/repo/worktree.py b/dvc/repo/worktree.py
--- a/dvc/repo/worktree.py
+++ b/dvc/repo/worktree.py
@@ -166,7 +166,7 @@ def push_worktree(
                     latest_only=remote_obj.worktree,
                     jobs=jobs,
                 )
-                pushed += sum(len(changes) for changes in diff.changes.values())
+                pushed += len(diff.files_create)
             except VersioningNotSupported:
                 logger.exception("")
                 raise DvcException(


Test patch: