Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nf-core list throws InvalidGitRepositoryError error #1273

Closed
mahesh-panchal opened this issue Sep 17, 2021 · 1 comment · Fixed by #1445
Closed

nf-core list throws InvalidGitRepositoryError error #1273

mahesh-panchal opened this issue Sep 17, 2021 · 1 comment · Fixed by #1445
Labels
bug Something isn't working
Milestone

Comments

@mahesh-panchal
Copy link
Member

Description of the bug

nf-core list throws an InvalidGitRepositoryError:/home/mahesh/.nextflow/assets/NBISweden/pipelines-nextflow.
It's looking at the wrong folder for the nf-core assets.

$ ls /home/mahesh/.nextflow/assets/
ewels  NBISweden  nextflow-io  nf-core

Steps to reproduce

Steps to reproduce the behaviour:

  1. conda activate nextflow-env ( has nf-core 2.1 installed, along with nextflow, mamba, and pandoc ).

  2. nf-core list

  3. See error:

$ nf-core list

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.1



╭───────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────╮
│ /home/mahesh/.conda/envs/nextflow-env/bin/nf-core:10 in <module>                                                                            │
│                                                                                                                                             │
│    9 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                                                                   │
│ ❱ 10 │   sys.exit(run_nf_core())                                                                                                            │
│   11                                                                                                                                        │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/nf_core/__main__.py:62 in run_nf_core                                     │
│                                                                                                                                             │
│    61 │   # Lanch the click cli                                                                                                             │
│ ❱  62 │   nf_core_cli()                                                                                                                     │
│    63                                                                                                                                       │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/click/core.py:1134 in __call__                                            │
│                                                                                                                                             │
│   1133 │   │   """Alias for :meth:`main`."""                                                                                                │
│ ❱ 1134 │   │   return self.main(*args, **kwargs)                                                                                            │
│   1135                                                                                                                                      │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/click/core.py:1059 in main                                                │
│                                                                                                                                             │
│   1058 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                                                             │
│ ❱ 1059 │   │   │   │   │   rv = self.invoke(ctx)                                                                                            │
│   1060 │   │   │   │   │   if not standalone_mode:                                                                                          │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/click/core.py:1665 in invoke                                              │
│                                                                                                                                             │
│   1664 │   │   │   │   with sub_ctx:                                                                                                        │
│ ❱ 1665 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                                                          │
│   1666                                                                                                                                      │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/click/core.py:1401 in invoke                                              │
│                                                                                                                                             │
│   1400 │   │   if self.callback is not None:                                                                                                │
│ ❱ 1401 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                                                           │
│   1402                                                                                                                                      │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/click/core.py:767 in invoke                                               │
│                                                                                                                                             │
│    766 │   │   │   with ctx:                                                                                                                │
│ ❱  767 │   │   │   │   return __callback(*args, **kwargs)                                                                                   │
│    768                                                                                                                                      │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/nf_core/__main__.py:156 in list                                           │
│                                                                                                                                             │
│   155 │   """                                                                                                                               │
│ ❱ 156 │   print(nf_core.list.list_workflows(keywords, sort, json, show_archived))                                                           │
│   157                                                                                                                                       │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/nf_core/list.py:36 in list_workflows                                      │
│                                                                                                                                             │
│    35 │   wfs.get_remote_workflows()                                                                                                        │
│ ❱  36 │   wfs.get_local_nf_workflows()                                                                                                      │
│    37 │   wfs.compare_remote_local()                                                                                                        │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/nf_core/list.py:142 in get_local_nf_workflows                             │
│                                                                                                                                             │
│   141 │   │   for wf in self.local_workflows:                                                                                               │
│ ❱ 142 │   │   │   wf.get_local_nf_workflow_details()                                                                                        │
│   143                                                                                                                                       │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/nf_core/list.py:357 in get_local_nf_workflow_details                      │
│                                                                                                                                             │
│   356 │   │   │   try:                                                                                                                      │
│ ❱ 357 │   │   │   │   repo = git.Repo(self.local_path)                                                                                      │
│   358 │   │   │   │   self.commit_sha = str(repo.head.commit.hexsha)                                                                        │
│                                                                                                                                             │
│ /home/mahesh/.conda/envs/nextflow-env/lib/python3.7/site-packages/git/repo/base.py:198 in __init__                                          │
│                                                                                                                                             │
│    197 │   │   │   self.git_dir = cast(PathLike, self.git_dir)                                                                              │
│ ❱  198 │   │   │   raise InvalidGitRepositoryError(epath)                                                                                   │
│    199                                                                                                                                      │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
InvalidGitRepositoryError: /home/mahesh/.nextflow/assets/NBISweden/pipelines-nextflow

Expected behaviour

List nf-core workflows.
To only check the nf-core assets and not any others.

System

  • Hardware: HPC, Laptop
  • OS: Linux, macOS
  • Version of nf-core/tools: 2.1
  • Python version: 3.7.10
@mahesh-panchal mahesh-panchal added the bug Something isn't working label Sep 17, 2021
@ewels ewels added this to the 2.3 milestone Dec 9, 2021
@drpatelh drpatelh modified the milestones: 2.4, 2.3 Mar 8, 2022
@ewels ewels changed the title Nf-core list throws InvalidGitRepositoryError nf-core list throws InvalidGitRepositoryError error Mar 14, 2022
@ewels
Copy link
Member

ewels commented Mar 14, 2022

So after some Slack debugging with @mahesh-panchal we figured out that this path contains a broken repo clone somehow. Indeed, nf-core list crashes with this error if it encounters a path in the Nextflow assets folders that isn't a repo.

This basically shouldn't ever happen, as these assets directories are generated by Nextflow pulling a repo. However, it would still be nice to handle the error in a better way if it does instead of giving a huge traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants