gto icon indicating copy to clipboard operation
gto copied to clipboard

gto show gives list index out of range error when supplied with --version

Open fortminors opened this issue 1 year ago โ€ข 3 comments

Hello! I am getting this error when I try to get the last version of the artifact at the non existent stage.

Let's say I have the following registry:

$ gto show:

โ•’โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ••
โ”‚ name                  โ”‚ latest   โ”‚ #prod   โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚<artifact_name>        โ”‚ v0.0.2   โ”‚ v0.0.2  โ”‚
โ•˜โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•›

I am doing the following: $ gto show <artifact_name>#develop -r <remote_repo_url> --version

And I get the following output:

โŒ Unexpected error: list index out of range
Please report it here running with '--traceback' flag: <https://github.com/iterative/gto/issues>

I believe the command should output empty string in this case, as develop stage does not exist yet.

gto show <artifact_name>#develop -r <remote_repo_url> --json gives [], so I guess it could be checked for emptiness?

$ gto doctor:

๐Ÿชด  GTO Version: 0.2.7
---------------------------------
INDEX='artifacts.yaml'
TYPES=None
STAGES=None
LOG_LEVEL='INFO'
DEBUG=False
ENRICHMENTS=[]
AUTOLOAD_ENRICHMENTS=True
CONFIG_FILE_NAME='.gto'
EMOJIS=True
---------------------------------
โœ…  No issues found

PS: Passing --traceback says No such option: --traceback for some reason

fortminors avatar Mar 20 '23 14:03 fortminors

Thanks for reporting @fortminors! I'll investigate.

aguschin avatar Mar 24 '23 10:03 aguschin

Yes, you're right!

For --traceback option, it should be put in the beginning: gto --tb show <artifact_name>#develop -r <remote_repo_url>

Do you mind contributing a fix? This should be adding a few lines, just like you described. The CI/CD will check your PR for issues - if something won't work, I'll help figuring it out.

aguschin avatar Mar 24 '23 10:03 aguschin

It also worth adding a simple test just like this one https://github.com/iterative/gto/blob/main/tests/test_cli.py#L139

aguschin avatar Mar 24 '23 10:03 aguschin