nextflow slurm withLabel clusterOptions not being applied
16:37 18 Nov 2025

I am trying to set up a workflow using nextflow v.25.04.7, but I am having issues with the -withLabel options.

Here is the relevant code in nextflow.config:

process {
  executor = "slurm"
  withLabel: gpuL4 {
    account = 
    qos = 
    gpus = 2
    mem = 100gb
    cpus-per-task = 24
  }
}

The error I am getting is:

  Compile failed for sources FixedSetSources[name='/groovy/script/Script441EB77E4314D3ECAE31864344DE1769/_nf_config_afa31bf8']. Cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  /groovy/script/Script441EB77E4314D3ECAE31864344DE1769/_nf_config_afa31bf8: 8: The LHS of an assignment should be a variable or a field accessing expression @ line 8, column 5.
         cpus-per-task = 24
         ^
  
  1 error


 -- Check '.nextflow.log' file for details

I am not sure if this depends on the dashes of the option, or what else I am doing wrong.

I have also tried the following:

process {
  executor = "slurm"
  clusterOptions = "--account= --qos=-b"
  withLabel: gpuL4 {
      clusterOptions = "--account= --qos= --gpus=2 --cpus-per-task=24 --mem=150gb"
  }
}

But I keep running out of memory, and I don't think the options are actually getting applied. In this case, I look at the .command.run in the workdir, and the options seem to be all on the same line:

#!/bin/bash
#SBATCH -J nf-PbDNA_mapping_(1)
#SBATCH -o /.command.log
#SBATCH --no-requeue
#SBATCH --signal B:USR2@30
#SBATCH -t 05:00:00
#SBATCH --mem 102400M
#SBATCH --account=icbr-umbrella --qos=icbr-umbrella --gpus=2 --cpus-per-task=24 --mem=150gb 

Please note that I have masked group name and paths (e.g. '') I am looking forward to your feedback.

slurm nextflow