nextflow-io / nextflow-io/nextflow

Method with hyphens between quotes fails with in syntax parser v2

Open
#7,009 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

When declaring a process with hyphens, it fails because it is not a valid method in groovy. However, when adding it between quotes, it works for syntax parser V1, but not for V2 it fails.

Expected behavior and actual behavior

Both parsers should run the process, or at least this change must be document in the strict syntax.

Steps to reproduce the problem

main.nf

process 'MY-MODULE' {
    input:
    val greeting

    output:
    stdout

    script:
    """
    echo '${greeting}'
    """
}

workflow {
 'MY-MODULE'("hola")
}
$ NXF_SYNTAX_PARSER=v1 nextflow run main.nf

 N E X T F L O W   ~  version 26.03.1-edge

Launching `main.nf` [special_kay] revision: e9bbf97ff2

executor >  local (1)
[08/99abf6] process > MY-MODULE [100%] 1 of 1 ✔

jorgee@PF54MRDZ:~$ NXF_SYNTAX_PARSER=v2 dev_nextflow run main.nf

 N E X T F L O W   ~  version 26.03.1-edge

Launching `main.nf` [serene_kimura] revision: e9bbf97ff2

Error main.nf:5:1: Invalid process definition -- check for missing or out-of-order section labels
│   3 |  */
│   4 | 
│   5 | process 'MY-MODULE' {
│     | ^^^^^^^^^^^^^^^^^^^^^
│   6 |     input:
╰   7 |     val greeting


ERROR ~ Script compilation failed

 -- Check '.nextflow.log' file for details
Program output
Apr-07 15:58:03.862 [main] DEBUG nextflow.Session - Session start
Apr-07 15:58:03.866 [main] DEBUG nextflow.script.ScriptLoaderFactory - Using script parser v2
Apr-07 15:58:03.926 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files:
Apr-07 15:58:03.937 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=0; peakCpus=0; peakMemory=0; ]
Apr-07 15:58:04.077 [main] ERROR nextflow.cli.Launcher - Script compilation failed
nextflow.exception.ScriptCompilationException: Script compilation failed
        at nextflow.script.parser.v2.ScriptLoaderV2.parse0(ScriptLoaderV2.groovy:129)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse(ScriptLoaderV2.groovy:81)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse(ScriptLoaderV2.groovy)
        at nextflow.script.ScriptRunner.parseScript(ScriptRunner.groovy:215)
        at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:126)
        at nextflow.cli.CmdRun.run(CmdRun.groovy:441)
        at nextflow.cli.Launcher.run(Launcher.groovy:526)
        at nextflow.cli.Launcher.main(Launcher.groovy:686)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main: 5: Invalid process definition -- check for missing or out-of-order section labels @ line 5, column 1.
   process 'MY-MODULE' {
   ^

1 error

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:292)
        at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:148)
        at nextflow.script.parser.ScriptAstBuilder.collectSyntaxError(ScriptAstBuilder.java:2187)
        at nextflow.script.parser.ScriptAstBuilder.compilationUnit(ScriptAstBuilder.java:230)
        at nextflow.script.parser.ScriptAstBuilder.buildAST(ScriptAstBuilder.java:202)
        at nextflow.script.parser.ScriptParserPlugin.buildAST(ScriptParserPlugin.java:51)
        at org.codehaus.groovy.control.SourceUnit.buildAST(SourceUnit.java:256)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:631)
        at nextflow.script.parser.v2.ScriptCompiler.compile0(ScriptCompiler.java:146)
        at nextflow.script.parser.v2.ScriptCompiler.compile(ScriptCompiler.java:112)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse0(ScriptLoaderV2.groovy:114)
        ... 7 common frames omitted
Environment
  • Nextflow version: 26.03.1-edge
  • Java version: 24
  • Operating system: Linux, e

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

Reproduce main.nf with NXF_SYNTAX_PARSER=v1 and v2, then start from ScriptLoaderV2.groovy and the ScriptAstBuilder stack frame. Compare how the quoted process name is parsed in each mode. Done means the v2 behavior matches the agreed v1 behavior, or the strict-syntax documentation clearly records the limitation.

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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.