nextflow-io / nextflow-io/nextflow

Profiles via includeConfig are not applied in command line order

Open
#7,472 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

Expected versus actual behaviour

Based on the section of the docs below, using the v2 syntax parser I'd expect any profile to be applied in the command line order, whether defined in the profile block or via a later includeConfig.

Added in version 25.04
When using the [strict parser](https://docs.seqera.io/nextflow/strict-syntax), Nextflow applies profiles in the order you specify them on the command line.

The actual behaviour: the expected profile priority is applied for the profile { ... } block in nextflow.config but in config file position for profiles included via includeConfig.

This impacts for example nf-core pipelines, whereby running the test profile plus uppmax or any institutional config will always result in uppmax taking priority.

Steps to reproduce the problem

main.nf

workflow {
    reportValues().view { it.trim() }
}

process reportValues {
    output:
    stdout

    script:
    """
    cat <<EOF
    profile_label=${params.profile_label}
    cpus=${task.cpus}
    EOF
    """
}

nextflow.config

params {
    profile_label = 'base'
}

process {
    cpus = 20
}

profiles {
    first {
        params {
            profile_label = 'first'
        }
        process {
            cpus = 1
        }
    }
    second {
        params {
            profile_label = 'second'
        }
        process {
            cpus = 2
        }
    }
}

includeConfig 'conf/third.config'

conf/third.config

profiles {
    third {
        params {
            profile_label = 'third'
        }
        process {
            cpus = 3
        }
    }
}
Program output

Expected behaviour
nextflow main.nf -profile first,second

[76/d3c159] process > reportValues [100%] 1 of 1 ✔
profile_label=second
cpus=2

Expected behaviour
nextflow main.nf -profile second,first

[b3/2c30bf] process > reportValues [100%] 1 of 1 ✔
profile_label=first
cpus=1

Unexpected behaviour

pixi run nextflow main.nf -profile third,first

[fc/12794c] process > reportValues [100%] 1 of 1 ✔
profile_label=third
cpus=3
Environment
  • Nextflow version: 26.04.6 build 12646
  • Java version: openjdk 25.0.2
  • Operating system: Ubuntu
  • Bash version: GNU bash, version 5.2.21
Additional context

If this is expected behaviour, it would be great to have it documented in the relevant sections:

https://docs.seqera.io/nextflow/config#config-profiles

https://docs.seqera.io/nextflow/config#includes

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 reproducing the commands in main.nf with nextflow.config and conf/third.config, comparing profile_label and cpus for profiles defined in the main file versus includeConfig. Trace how the v2 syntax parser applies profiles from these files and verify that the resulting priority follows command-line order for both cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.