question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`plots diff` & `exp show`: unexpected error - Empty git repo

See original GitHub issue

Bug Report

Description

After initialising a repository with both Git and DVC both plots diff and exp show throw ERROR: unexpected error - Empty git repo.

Reproduce

  1. mkdir new
  2. cd new
  3. git init
  4. dvc init
  5. dvc exp show => throws error
  6. dvc plots diff => throws error

Expected

Neither of these commands should throws an error under these circumstances but they should return an empty dict for the --json option.

Environment information

Output of dvc doctor:

$ dvc doctor
DVC version: 2.18.1 (pip)
---------------------------------
Platform: Python 3.9.13 on macOS-12.5.1-arm64-arm-64bit
Supports:
	http (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
	https (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
	webhdfs (fsspec = 2022.7.1)
Cache types: <https://error.dvc.org/no-dvc-cache>
Caches: local
Remotes: None
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git

Additional Information (if any):

This was brought up in the cross team meeting and is part of a larger discussion on error handling.

The requested behaviour is exhibited under the same circumstances for the following commands:

/new master +3 ❯ dvc list . --dvc-only --recursive --json
[]
/new master +3 ❯ dvc status --json
{}
/new master +3 ❯ dvc diff --json
{}
/new master +3 ❯ dvc data status --json
{}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pmrowlacommented, Aug 25, 2022

https://github.com/iterative/dvc/blob/460d08057cf355686e1337b94640ac8522497bb1/dvc/scm.py#L163

This should also be

if not (rev == "HEAD" or rev.startswith("refs/")):

(This does not resolve the issue, but it makes DVC generate a proper error message rather than unexpected error.)

ERROR: failed to show experiments - unknown Git revision ‘HEAD’

1reaction
daavoocommented, Aug 25, 2022

I think we just need to do the same as dvc diff / exp diff / metrics diff / params diff:

https://github.com/iterative/dvc/blob/460d08057cf355686e1337b94640ac8522497bb1/dvc/repo/diff.py#L23-L24

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git error - Fatal: Not a git repository and how to fix it | Datree.io
This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: Navigated to the right...
Read more >
gitlab runner doesn`t work on a specific project - Stack Overflow
But after I commit/push some changes, an error occurs and failed job. I saw some solutions that upgrading the git version solved a...
Read more >
Troubleshooting | Data Version Control - DVC
Failed to pull data from the cloud · Too many open files error · Unable to find credentials · Unable to connect ·...
Read more >
git init | Atlassian Git Tutorial
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository...
Read more >
Message "destination path 'XXX' already exists and is not an ...
Enter the directory: cd local repository directory · Clone the cloud repository to the tmp directory. git clone --no-checkout repository URL tmp.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found