Skip to content

feat: use nextflow lint -files-from stdin to avoid ARG_MAX - #12

Merged
adamrtalbot merged 5 commits into
mainfrom
feat/files-from
Jul 2, 2026
Merged

adamrtalbot merged 5 commits into
mainfrom
feat/files-from

Conversation

@adamrtalbot

Copy link
Copy Markdown
Collaborator

Why

nextflow lint fails with Argument list too long (E2BIG) when a large repo passes thousands of .nf/.config files as CLI arguments — the OS ARG_MAX limit (~2MB) is exceeded. Reported upstream in nextflow-io/nextflow#6857.

The current hook works around this by batching files into groups of 200 and invoking nextflow lint once per batch. That spins up a fresh JVM per batch (1700 files → 9 JVM startups) and needs output filtering to hide per-batch success noise.

nextflow-io/nextflow#6858 (Nextflow 26.04) added a native -files-from option that reads paths from a file or stdin, keeping them off argv entirely.

What

  • Hook: replace the batching loop with a single streamed invocation — printf '%s\n' "${files[@]}" | nextflow lint ${args} -files-from -. One JVM regardless of file count; no ARG_MAX ceiling; paths with spaces stay safe (newline-delimited). Exit code propagates via pipefail.
  • README: bump minimum Nextflow to v26.04+; document stdin streaming.
  • CI: bump version matrix 25.04.6 → 26.04.0; add a 500-file test exercising the stdin path.

🤖 Generated with Claude Code

Replace the batching workaround with the native -files-from - option
(Nextflow >= 26.04, nextflow-io/nextflow#6858). Filenames are streamed
via stdin so they never hit the OS ARG_MAX limit, in a single JVM
invocation regardless of file count.

- hook: pipe filenames to 'nextflow lint -files-from -' instead of
  batching positional args across multiple JVM invocations
- README: bump minimum Nextflow to v26.04+, document stdin streaming
- CI: bump version matrix to 26.04.0, add a 500-file ARG_MAX test

Closes nextflow-io/nextflow#6857 downstream.

Generated by Claude Code
Comment thread README.md Outdated
Comment thread nextflow-lint-hook
echo "Please install nextflow from https://www.nextflow.io/"
exit 1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also check the nextflow version, I think, given we require a specific version now.

adamrtalbot and others added 2 commits July 2, 2026 10:39
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
-files-from is only available in Nextflow 26.04+, so fail early with a
clear message if an older version is on PATH rather than emitting a
confusing 'unknown option' error. Warns (does not block) if the version
cannot be parsed.

Generated by Claude Code

@mashehu mashehu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could make a CI test for the version test, but probably not worth the bother

Comment thread nextflow-lint-hook Outdated
# relies on to stream filenames via stdin (avoids the OS ARG_MAX limit).
required_major=26
required_minor=4
nf_version=$(nextflow -version 2>/dev/null | grep -oE 'version [0-9]+\.[0-9]+' | head -1 | grep -oE '[0-9]+\.[0-9]+' || true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nf_version=$(nextflow -version 2>/dev/null | grep -oE 'version [0-9]+\.[0-9]+' | head -1 | grep -oE '[0-9]+\.[0-9]+' || true)
nf_version=$(nextflow -version 2>/dev/null | sed -nE 's/.*version ([0-9]+\.[0-9]+).*/\1/p' || true)

sorry, a nit-pick from all the version topics PRs in modules 😁

Comment thread nextflow-lint-hook Outdated
nf_minor=${nf_version#*.}
# 10# forces base-10 so leading zeros (e.g. 04) are not read as octal
if (( 10#$nf_major < required_major || (10#$nf_major == required_major && 10#$nf_minor < required_minor) )); then
echo "Error: Nextflow >= ${required_major}.$(printf '%02d' "$required_minor") is required (found ${nf_version}); the -files-from option was added in ${required_major}.$(printf '%02d' "$required_minor")"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Error: Nextflow >= ${required_major}.$(printf '%02d' "$required_minor") is required (found ${nf_version}); the -files-from option was added in ${required_major}.$(printf '%02d' "$required_minor")"
echo "Error: Nextflow >= ${required_major}.$(printf '%02d' "$required_minor") is required (found ${nf_version})"

again no need for techincal explanations (that might change in the future anyway)

Comment thread README.md Outdated
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
@adamrtalbot
adamrtalbot merged commit 9b76282 into main Jul 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants