-
Notifications
You must be signed in to change notification settings - Fork 776
Closed
Labels
Description
Bug report
With v2 strict syntax, params defined in the workflow script are not visible to included modules. This also impacts typed params, which cannot be used with modules.
Test Matrix
| Test Case | v1 | v2 |
|---|---|---|
params.x = ... in script + module |
✅ | ❌ |
params.x = ... in config + module |
✅ | ✅ |
params { x: Type = ... } in script + module |
N/A | ❌ |
params { x: Type = ... } in config |
❌ syntax error | ❌ syntax error |
Impact on Typed Params
Typed params cannot be used with modules because:
- Typed params only work in scripts (config gives syntax error)
- But with v2, script-defined params are not visible to modules
- The workaround (move params to config) loses typed params entirely
Minimal reproducible example
modules/greet/main.nf:
process GREET {
publishDir { params.outdir }, mode: 'copy'
output:
path "greeting.txt"
script:
"""
echo "Hello World" > greeting.txt
"""
}main.nf (fails with v2):
#!/usr/bin/env nextflow
params.outdir = "results"
include { GREET } from './modules/greet/main.nf'
workflow {
GREET()
}Results
Tested with Nextflow 25.10.2:
# v1: works
nextflow run main.nf
# v2: fails
NXF_SYNTAX_PARSER=v2 nextflow run main.nfv2 output:
WARN: Access to undefined parameter `outdir`
ERROR ~ Target path for directive publishDir cannot be null
Typed params in config (syntax error)
// nextflow.config - this fails
params {
outdir: String = "results"
}Error nextflow.config:2:20: Unexpected input: '='
│ 2 | outdir: String = "results"
╰ | ^
ERROR ~ Config parsing failed
Documentation vs behavior
The module documentation states:
"The module inherits the parameters defined before the
includestatement"
The strict syntax documentation describes using params in modules as a best practice issue, not a breaking change.
Workaround
Move params to nextflow.config using untyped syntax:
params.outdir = "results"This works but loses the typed params feature.
Reactions are currently unavailable