nf-core / nf-core/tools

Malformed or missing manifest.name gives opaque error / IndexError instead of a lint failure

Open
#4,467 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

Description of the bug

nf-core pipelines lint handles a malformed or missing manifest.name badly, in two distinct ways depending on the value.

  1. name present but without a / (e.g. name = 'My-Pipeline') - lint aborts with a single line and no traceback:

ERROR not enough values to unpack (expected 2, got 1)

Nothing indicates which config field is at fault. --verbose does not help: the debug output ends at config loading and the same bare ERROR follows, with no frame information. The abort happens before Testing pipeline: is printed, so it occurs during pipeline init rather than in a lint test.

  1. name absent entirely - the fallback engages, then crashes downstream:
INFO     Testing pipeline: /path/to/pipeline
WARNING  Expected manifest.name to be in the format '<repo>/<pipeline>'. Will assume it is '<pipeline>'.
...
│ /usr/local/lib/python3.12/site-packages/nf_core/pipelines/lint/__init__.py:276 in _lint_pipeline │
│ ❱ 276 │   test_results = getattr(self, test_name)()                                              │
│ /usr/local/lib/python3.12/site-packages/nf_core/pipelines/lint/files_exist.py:201 in files_exist │
│ ❱ 201 │   Path("lib", f"Workflow{short_name[0].upper()}{short_name[1:]}.groovy"),                │
IndexError: string index out of range

short_name is "" here, and line 201 indexes short_name[0].

Neither case is reported as a lint failure, and in case 1 there is no way for a user to tell that manifest.name is the cause.

Related unguarded split sites in the lint code:

nf_core/pipelines/lint/files_exist.py:125     _, short_name = pipeline_name.split("/")
nf_core/pipelines/lint/files_unchanged.py:74  prefix, short_name = manifest_config.get("name", "").split("/")

The second is the same pattern reported in #2445, and its "" default cannot unpack either. Both run after Testing pipeline: is printed, so neither is the source of case 1 - that call site is earlier and I was not able to locate it from the CLI output.

Setting name = 'abc/My-Pipeline' resolves both.

Two suggested fixes:

  1. Validate manifest.name during pipeline init and raise UserWarning("manifest.name must be in the format '<repo>/<pipeline>'"), so run_linting reports it as a lint failure with a message naming the field, in both cases.
  2. In files_exist.py:201, use short_name[:1].upper() instead of short_name[0].upper() so an empty name cannot raise IndexError.
Command used and terminal output

CASE 1:

$ nf-core pipelines lint

nf-core/tools version 4.1.0 - https://nf-co.re

ERROR    not enough values to unpack (expected 2, got 1)

CASE 2:

INFO     Testing pipeline: /path/to/pipeline
WARNING  Expected manifest.name to be in the format '<repo>/<pipeline>'. Will assume it is '<pipeline>'.
│ /usr/local/lib/python3.12/site-packages/nf_core/pipelines/lint/__init__.py:276 in _lint_pipeline │
│ ❱ 276 │   test_results = getattr(self, test_name)()                                              │
│ /usr/local/lib/python3.12/site-packages/nf_core/pipelines/lint/files_exist.py:201 in files_exist │
│ ❱ 201 │   Path("lib", f"Workflow{short_name[0].upper()}{short_name[1:]}.groovy"),                │
IndexError: string index out of range

Reproducers, both on the same pipeline:

Case 1: manifest { name = 'My-Pipeline' }
Case 2: manifest block with no name entry

nf-core/tools is installed as an Apptainer image invoked through a wrapper (apptainer exec nfcore_4.1.0a.sif /usr/local/bin/nf-core "$@"), so the Python is the image's.

System information
  • Nextflow version: 25.04.4
  • Hardware: HPC
  • Executor: slurm
  • OS: Rocky Linux 8.10 (Green Obsidian)
  • Version of nf-core/tools: 4.1.0
  • Python version: 3.12.13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nf_core/pipelines/lint/init.py around _lint_pipeline, then inspect the split sites in files_exist.py and files_unchanged.py, including files_exist.py:201. Run nf-core pipelines lint against the two manifest reproducers; done means malformed or missing manifest.name is reported as a named lint failure rather than an unpacking error or IndexError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.