Skip to content

fix: batch files in lint hook to avoid ARG_MAX on large repos - #4

Merged
adamrtalbot merged 4 commits into
mainfrom
fix/batch-files-argmax
Mar 2, 2026
Merged

adamrtalbot merged 4 commits into
mainfrom
fix/batch-files-argmax

Conversation

@adamrtalbot

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes "Argument list too long" (E2BIG) errors when running the pre-commit hook on large repositories (e.g. nf-core/modules with thousands of .nf files)
  • Pre-commit passes all matching filenames as CLI arguments to nextflow lint, which can exceed the OS ARG_MAX limit (argv + envp combined)
  • Files are now processed in batches of 200, keeping each invocation well within limits while avoiding excessive JVM startup overhead

Context

Reported from https://github.com/nf-core/modules/actions/runs/22347821806/job/64668726513?pr=10241#step:4:156

The error manifests as every execve() inside the Nextflow launcher script failing:

nextflow: line 287: /usr/bin/dirname: Argument list too long
nextflow: line 323: /usr/bin/sed: Argument list too long
nextflow: line 327: java: Argument list too long

On repositories with thousands of .nf files (e.g. nf-core/modules),
pre-commit passes all matching filenames as CLI arguments, exceeding
the OS ARG_MAX limit. Process files in batches of 200 to stay within
the limit while keeping JVM startup overhead reasonable.

Generated by Claude Code
On success, shows a single line: '✅ Nextflow lint passed (N files)'
On failure, dumps full output so errors are easy to find.

Generated by Claude Code
Let nextflow lint output stream directly so errors are always
visible. The per-batch success noise is a nextflow lint UX issue
tracked upstream (nextflow-io/nextflow#6856).

Generated by Claude Code
Capture output from all batches and always display it, but filter
out 'Nextflow linting complete!' and 'files had no errors' summary
lines. Errors, warnings, and diagnostics are never hidden.

Generated by Claude Code
@adamrtalbot
adamrtalbot merged commit 3e687de into main Mar 2, 2026
6 checks passed
@adamrtalbot
adamrtalbot deleted the fix/batch-files-argmax branch March 2, 2026 13:13
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.

1 participant