Fix "No such variable" in typed output block with job arrays#7221
Merged
Conversation
When job array batching is enabled (process `array` directive), the
parent `TaskArrayRun` is created with a fresh, empty task context — it is
only a launcher that dispatches its child tasks and stages no outputs of
its own.
However `TaskBean` calls `getOutputFilesNames()` for every task, including
the array parent. For typed (v2) processes this evaluates the
process-level declared output patterns against the task context, and a
pattern that references an input variable (e.g.
`file("${localFile.baseName}_sce.rds")`) fails with
`No such variable: localFile` because the parent context has no inputs
bound. DSL v1 was unaffected because it reads the task's instance-resolved
outputs, which are empty for the parent.
Override `getOutputFilesNames()` in `TaskArrayRun` to return an empty list,
matching the effective v1 behaviour and avoiding evaluation of output
declarations against the parent's empty context.
Fixes #7215
Signed-off-by: Jorge Ejarque <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
bentsherman
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #7215.
A typed (v2) process that references an input variable in an output file pattern fails with
ERROR ~ No such variable: <input>when job array batching is active, e.g.:-profile slurm --arraySize 2(array enabled)-profile slurm --arraySize 1(no array)-profile localRoot cause
When
array > 1,TaskArrayCollector.createTaskArray()builds a parentTaskArrayRunwith a fresh, empty task context — it is only a launcher that dispatches the child tasks and stages no outputs of its own.TaskBeancallsgetOutputFilesNames()for every task, including the array parent. For typed (v2) processes,getOutputFilesNamesV2()evaluates the process-level declared output patterns against the task context. The parent's context has no inputs bound, so resolvingfile("${localFile.baseName}_sce.rds")throwsNo such variable: localFile.DSL v1 was unaffected because
getOutputFilesNamesV1()reads the task's instance-resolved outputs, which are empty for the parent.Fix
Override
getOutputFilesNames()inTaskArrayRunto return an empty list. The array parent stages no outputs of its own (children unstage their own outputs); this matches the effective v1 behaviour and avoids evaluating output declarations against the parent's empty context.Testing
TaskArrayRunTest— verified it fails without the fix and passes with it.slurm arraySize=2,slurm arraySize=1,local) now succeed, with child output files correctly produced and staged.🤖 Generated with Claude Code