Skip to content

Compilation error when declaring typed params in params {} block (you tried to assign a value to the class 'java.lang.Boolean') #6516

@xies4

Description

@xies4

Expected behavior and actual behavior

Expected:

Either:

  • Nextflow accepts type annotations in the params {} block (e.g., save_intermeds: Boolean = false)

or

  • The compiler surfaces a clearer, actionable error explaining that the params scope is an untyped map and does not support type annotations, with guidance to use save_intermeds = false.

Actual: Script fails to compile with:

you tried to assign a value to the class 'java.lang.Boolean'

which suggests a misuse of the Boolean class rather than explaining the constraint of the params block.

Steps to reproduce the problem

  1. Create test.nf with the following contents:
params {
    // Path to input data.
    input: Path

    // Whether to save intermediate files.
    save_intermeds: Boolean = false
}

workflow {
    println "params.input = ${params.input}"
    println "params.save_intermeds = ${params.save_intermeds}"
}
  1. Run:
nextflow run test.nf --input test.txt

Program output

N E X T F L O W   ~  version 25.10.0

Launching `test.nf` [gloomy_volhard] DSL2 - revision: 08815e7ae7

ERROR ~ Script compilation error
- file : /mnt/ccrsf-static/Analysis/xies4/RnD_projects/repro_DNAmeth/data/test.nf
- cause: you tried to assign a value to the class 'java.lang.Boolean'
 @ line 6, column 21.
       save_intermeds: Boolean = false
                       ^

1 error


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

Environment

Nextflow version: 25.10.0

Java version: openjdk 24.0.2 2025-07-15

Operating system: Linux fsitgl-head01p.ncifcrf.gov 4.18.0-553.77.1.0.1.el8_10.x86_64 #1 SMP Tue Sep 30 01:24:10 PDT 2025 x86_64 x86_64 x86_64 GNU/Linux

Bash version: GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)

Can you help on address the issue? Thanks.

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