nextflow-io / nextflow-io/nextflow

Misleading error message when using shadowed process name in map

Open
#7,397 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage/investigate
Dominant language
Groovy
Stars
3.5k
Forks
811
Avg merge
2d 11h
Merged PRs (30d)
61

Description

If you run:

process FOO { 
    script: 
    '''
    echo hi
    ''' 
}

workflow {
    def FOO = 1
    channel.of(FOO).map { v -> FOO(v) }
}

it raises the following error:

Error test.nf:10:34: Processes cannot be called from within a closure
│  10 |       channel.of(FOO).map { v -> FOO(v) }
╰     |  

However if you do

channel.of(FOO).map { v -> FOO }.view{ v -> "v is ${v}"}

You find that v is 1 and that the process is in fact shadowed by the local variable declaration, so it would seem that the error should really be that FOO is not callable?

Environment
  • Nextflow version: 26.04.6

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 by running the supplied Nextflow script and comparing the process-call case with the shadowed-value case. Trace the closure invocation and name-resolution entry points to determine why the process-specific error is selected; done means the shadowed value produces an accurate non-callable error without changing the valid process behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.