Skip to content

Latest edge release wants secrets to be a list #6895

@prototaxites

Description

@prototaxites

Bug report

The following nf-core module: https://github.com/prototaxites/modules/blob/master/modules/nf-core/mitohifi/findmitoreference/main.nf

Gives the following error when running with Nextflow 26.02.0-edge:

Error executing process > 'SANGERTOL_GENOMEASSEMBLY:GENOMEASSEMBLY:ORGANELLE_ASSEMBLY:MITOHIFI_ASSEMBLY:MITOHIFI_FINDMITOREFERENCE (Caradrina clavipalpis)'
  
  Caused by:
    Cannot cast object 'NCBI_API_KEY' with class 'java.lang.String' to class 'java.util.List'

Replacing the secret declaration with:

secret secrets.NCBI_API_KEY ? ["NCBI_API_KEY"] : ""

Fixes the issue in both the current and edge Nextflow release, but this seems incorrect.

Expected behavior and actual behavior

The secret directive should accept a String.

Steps to reproduce the problem

process MITOHIFI_FINDMITOREFERENCE {
    tag "$species"
    label 'process_single'
    secret secrets.NCBI_API_KEY ? "NCBI_API_KEY" : ""

    // NOTE: An optional NCBI API key can be supplied to MITOHIFI_FINDMITOREFERENCE.
    // This should be set using Nextflow's secrets functionality:
    // `nextflow secrets set NCBI_API_KEY <key>`
    //
    // See https://www.nextflow.io/docs/latest/secrets.html for more information.

    // Docker image available at the project github repository
    container 'ghcr.io/marcelauliano/mitohifi:3.2.3'

    input:
    tuple val(meta), val(species)

    output:
    tuple val(meta), path("*.fasta"), path("*.gb"), emit: reference
    // WARN: Incorrect version information is provided by tool on CLI. Please update this string when bumping container versions.
    // old version command: \$(mitohifi.py -v | sed 's/.* //')
    tuple val("${task.process}"), val('mitohifi'), eval('echo 3.2.3'), emit: versions_mitohifi, topic: versions

    when:
    task.ext.when == null || task.ext.when

    script:
    // Exit if running this module with -profile conda / -profile mamba
    if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
        error "MitoHiFi module does not support Conda. Please use Docker / Singularity instead."
    }

    def args         = task.ext.args ?: ''
    def ncbi_api_key = secrets.NCBI_API_KEY ? "--ncbi-api-key \$NCBI_API_KEY" : ""
    """
    findMitoReference.py \\
        ${ncbi_api_key} \\
        --species "$species" \\
        --outfolder . \\
        $args
    """

    stub:
    """
    touch accession.fasta
    touch accession.gb
    """
}

workflow {
    MITOHIFI_FINDMITOREFERENCE([[:], "Homo sapiens"])
}
NXF_VER=26.02.0-edge nextflow run main.nf

Program output

Mar-05 14:17:47.365 [main] DEBUG nextflow.cli.Launcher - $> nextflow run main.nf
Mar-05 14:17:47.405 [main] DEBUG nextflow.cli.CmdRun - N E X T F L O W  ~  version 26.02.0-edge
Mar-05 14:17:47.422 [main] DEBUG nextflow.plugin.PluginsFacade - Setting up plugin manager > mode=prod; embedded=false; plugins-dir=/Users/jd42/.nextflow/plugins; core-plugins: nf-amazon@3.7.1,nf-azure@1.22.0,nf-cloudcache@0.6.0,nf-codecommit@0.5.0,nf-console@1.3.0,nf-google@1.26.1,nf-k8s@1.5.0,nf-seqera@0.12.0,nf-tower@1.21.0,nf-wave@1.18.0
Mar-05 14:17:47.440 [main] INFO  o.pf4j.DefaultPluginStatusProvider - Enabled plugins: []
Mar-05 14:17:47.440 [main] INFO  o.pf4j.DefaultPluginStatusProvider - Disabled plugins: []
Mar-05 14:17:47.442 [main] INFO  org.pf4j.DefaultPluginManager - PF4J version 3.12.0 in 'deployment' mode
Mar-05 14:17:47.450 [main] DEBUG nextflow.util.RetryConfig - Missing nextflow session - using default retry config
Mar-05 14:17:47.520 [main] DEBUG nextflow.plugin.PluginUpdater - Using plugin repository: HttpPluginRepository [registry]; url=https://registry.nextflow.io/api
Mar-05 14:17:47.523 [main] INFO  org.pf4j.AbstractPluginManager - No plugins
Mar-05 14:17:47.534 [main] DEBUG nextflow.config.ConfigBuilder - Found config local: /Users/jd42/Projects/test/nextflow.config
Mar-05 14:17:47.536 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /Users/jd42/Projects/test/nextflow.config
Mar-05 14:17:47.537 [main] DEBUG nextflow.config.ConfigParserFactory - Using config parser v2
Mar-05 14:17:47.544 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard`
Mar-05 14:17:47.687 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins default=[]
Mar-05 14:17:47.688 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins resolved requirement=[nf-tower@1.21.0]
Mar-05 14:17:47.814 [main] DEBUG n.plugin.HttpPluginRepository - Registry request: https://registry.nextflow.io/api/v1/plugins/dependencies?plugins=nf-tower%401.21.0&nextflowVersion=26.02.0-edge
- code: 200
- body: {"plugins":[{"id":"nf-tower","releases":[{"version":"1.21.0","url":"https://registry.nextflow.io/api/v1/plugins/nf-tower/1.21.0/download/nf-tower-1.21.0.zip","date":"2026-02-28T12:42:25.708898Z","sha512sum":"3c82b1e34a103b717a38af973eb2a3ddd01b669781be35adf86329936de5f82b140c354e3575274a5d02efc285549ecbdca378a2b0b17946dc2ad89d955b0398","requires":">=26.02.0-edge","dependsOn":[],"status":"PUBLISHED"}],"projectUrl":"https://github.com/nextflow-io/nf-tower","provider":"nextflow-io"}]}
Mar-05 14:17:47.835 [main] DEBUG nextflow.plugin.PluginUpdater - Installing plugin nf-tower version: 1.21.0
Mar-05 14:17:47.841 [main] INFO  org.pf4j.AbstractPluginManager - Plugin 'nf-tower@1.21.0' resolved
Mar-05 14:17:47.841 [main] INFO  org.pf4j.AbstractPluginManager - Start plugin 'nf-tower@1.21.0'
Mar-05 14:17:47.855 [main] DEBUG nextflow.plugin.BasePlugin - Plugin started nf-tower@1.21.0
Mar-05 14:17:47.866 [main] DEBUG n.secret.LocalSecretsProvider - Secrets store: /Users/jd42/.nextflow/secrets/store.json
Mar-05 14:17:47.867 [main] DEBUG nextflow.secret.SecretsLoader - Discovered secrets providers: [nextflow.secret.LocalSecretsProvider@717d7587] - activable => nextflow.secret.LocalSecretsProvider@717d7587
Mar-05 14:17:47.878 [main] DEBUG nextflow.cli.CmdRun - Launching `main.nf` [adoring_joliot] - revision: afb4da46c2
Mar-05 14:17:47.914 [main] DEBUG nextflow.Session - Session UUID: 151e5ef6-a2e0-4c21-9eff-719c02614e0d
Mar-05 14:17:47.914 [main] DEBUG nextflow.Session - Run name: adoring_joliot
Mar-05 14:17:47.915 [main] DEBUG nextflow.Session - Executor pool size: 11
Mar-05 14:17:47.918 [main] DEBUG nextflow.file.FilePorter - File porter settings maxRetries=3; maxTransfers=50; pollTimeout=null
Mar-05 14:17:47.921 [main] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'FileTransfer' minSize=10; maxSize=33; workQueue=LinkedBlockingQueue[-1]; allowCoreThreadTimeout=false
Mar-05 14:17:47.935 [main] DEBUG nextflow.cli.CmdRun -
  Version: 26.02.0-edge build 11371
  Created: 28-02-2026 12:06 UTC (12:06 BST)
  System: Mac OS X 26.3
  Runtime: Groovy 4.0.30 on OpenJDK 64-Bit Server VM 23.0.2+7
  Encoding: UTF-8 (UTF-8)
  Process: 17554@mib120118s [172.30.35.205]
  CPUs: 11 - Mem: 18 GB (70.9 MB) - Swap: 6 GB (1.3 GB)
Mar-05 14:17:47.941 [main] DEBUG nextflow.Session - Work-dir: /Users/jd42/Projects/test/work [Mac OS X]
Mar-05 14:17:47.941 [main] DEBUG nextflow.Session - Script base path does not exist or is not a directory: /Users/jd42/Projects/test/bin
Mar-05 14:17:47.946 [main] DEBUG nextflow.executor.ExecutorFactory - Extension executors providers=[]
Mar-05 14:17:47.952 [main] DEBUG nextflow.Session - Observer factory (v2): LinObserverFactory
Mar-05 14:17:47.953 [main] DEBUG nextflow.Session - Observer factory (v2): DefaultObserverFactory
Mar-05 14:17:47.960 [main] DEBUG nextflow.Session - Observer factory (v2): TowerFactory
Mar-05 14:17:47.974 [main] DEBUG nextflow.cache.CacheFactory - Using Nextflow cache factory: nextflow.cache.DefaultCacheFactory
Mar-05 14:17:47.978 [main] DEBUG nextflow.util.CustomThreadPool - Creating default thread pool > poolSize: 12; maxThreads: 1000
Mar-05 14:17:48.005 [main] DEBUG nextflow.Session - Session start
Mar-05 14:17:48.008 [main] DEBUG nextflow.script.ScriptLoaderFactory - Using script parser v2
Mar-05 14:17:48.164 [main] DEBUG nextflow.script.ScriptRunner - > Launching execution
Mar-05 14:17:48.221 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: null
Mar-05 14:17:48.221 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Mar-05 14:17:48.225 [main] DEBUG nextflow.executor.Executor - [warm up] executor > local
Mar-05 14:17:48.228 [main] DEBUG n.processor.LocalPollingMonitor - Creating local task monitor for executor 'local' > cpus=11; memory=18 GB; capacity=11; pollInterval=100ms; dumpInterval=5m
Mar-05 14:17:48.229 [main] DEBUG n.processor.TaskPollingMonitor - >>> barrier register (monitor: local)
Mar-05 14:17:48.245 [main] DEBUG nextflow.processor.TaskProcessor - Creating process 'MITOHIFI_FINDMITOREFERENCE': maxForks=0; fair=false; array=0
Mar-05 14:17:48.266 [main] DEBUG nextflow.Session - Process names: MITOHIFI_FINDMITOREFERENCE
Mar-05 14:17:48.273 [main] DEBUG nextflow.Session - Igniting dataflow network (2)
Mar-05 14:17:48.274 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > MITOHIFI_FINDMITOREFERENCE
Mar-05 14:17:48.274 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files:
  Main: /Users/jd42/Projects/test/main.nf
Mar-05 14:17:48.274 [main] DEBUG nextflow.script.ScriptRunner - > Awaiting termination
Mar-05 14:17:48.274 [main] DEBUG nextflow.Session - Session await
Mar-05 14:17:48.332 [Task submitter] DEBUG nextflow.processor.TaskProcessor - Handling unexpected condition for
  task: name=MITOHIFI_FINDMITOREFERENCE (Homo sapiens); work-dir=/Users/jd42/Projects/test/work/48/9569cc17fcea2157e6bdc69ed613d8
  error [org.codehaus.groovy.runtime.typehandling.GroovyCastException]: Cannot cast object 'NCBI_API_KEY' with class 'java.lang.String' to class 'java.util.List'
Mar-05 14:17:48.335 [Task submitter] ERROR nextflow.processor.TaskProcessor - Error executing process > 'MITOHIFI_FINDMITOREFERENCE (Homo sapiens)'

Caused by:
  Cannot cast object 'NCBI_API_KEY' with class 'java.lang.String' to class 'java.util.List'


org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'NCBI_API_KEY' with class 'java.lang.String' to class 'java.util.List'
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:415)
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:326)
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnCollection(DefaultTypeTransformation.java:284)
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:231)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at nextflow.processor.TaskConfig.getSecret(TaskConfig.groovy:375)
	at nextflow.processor.TaskBean.<init>(TaskBean.groovy:161)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at nextflow.processor.TaskRun.toTaskBean(TaskRun.groovy:1016)
	at nextflow.executor.local.LocalTaskHandler.buildTaskWrapper(LocalTaskHandler.groovy:127)
	at nextflow.executor.local.LocalTaskHandler.submit(LocalTaskHandler.groovy:97)
	at nextflow.processor.TaskPollingMonitor.submit(TaskPollingMonitor.groovy:275)
	at nextflow.processor.LocalPollingMonitor.submit(LocalPollingMonitor.groovy:197)
	at nextflow.processor.TaskPollingMonitor.submitPendingTasks(TaskPollingMonitor.groovy:659)
	at nextflow.processor.TaskPollingMonitor.submitLoop(TaskPollingMonitor.groovy:470)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
	at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1341)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1096)
	at groovy.lang.MetaClassImpl.invokeMethodClosure(MetaClassImpl.java:1019)
	at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1215)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1096)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009)
	at groovy.lang.Closure.call(Closure.java:433)
	at groovy.lang.Closure.call(Closure.java:412)
	at groovy.lang.Closure.run(Closure.java:505)
	at java.base/java.lang.Thread.run(Thread.java:1575)
Mar-05 14:17:48.337 [Task submitter] DEBUG nextflow.Session - Session aborted -- Cause: Cannot cast object 'NCBI_API_KEY' with class 'java.lang.String' to class 'java.util.List'
Mar-05 14:17:48.344 [Task submitter] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=1; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=0; peakCpus=0; peakMemory=0; ]
Mar-05 14:17:48.441 [Task monitor] DEBUG n.processor.TaskPollingMonitor - <<< barrier arrives (monitor: local) - terminating tasks monitor poll loop
Mar-05 14:17:48.546 [main] DEBUG nextflow.Session - Session await > all processes finished
Mar-05 14:17:48.546 [main] DEBUG nextflow.Session - Session await > all barriers passed
Mar-05 14:17:48.546 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=1; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=0; peakCpus=0; peakMemory=0; ]
Mar-05 14:17:48.550 [main] DEBUG nextflow.cache.CacheDB - Closing CacheDB done
Mar-05 14:17:48.557 [main] INFO  org.pf4j.AbstractPluginManager - Stop plugin 'nf-tower@1.21.0'
Mar-05 14:17:48.557 [main] DEBUG nextflow.plugin.BasePlugin - Plugin stopped nf-tower
Mar-05 14:17:48.559 [main] DEBUG nextflow.script.ScriptRunner - > Execution complete -- Goodbye

Environment

  • Nextflow version: [?]
  • Java version: [?]
  • Operating system: macOS
  • Bash version: (use the command $SHELL --version)

Additional context

(Add any other context about the problem here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions