Skip to content

Path listFiles return type not accepted by process path input #6152

@Gullumluvl

Description

@Gullumluvl

Bug report

I have a channel emitting a directory path, on which I call .listFiles(). However the class of the output collection of paths is Ljava.nio.file.Path, while a process input path seems to expect other kinds of collection (works with java.util.ArrayList and nextflow.util.ArrayTuple).

Expected behavior and actual behavior

Should not require an extra conversion step (need to wrap in tuple or as List).

Steps to reproduce the problem

Create a directory with two files:

mkdir testdir
touch testdir/{a,b}.txt

Run the following nextflow script:

process take_files {
    input:
    path(infiles)

    output:
    stdout

    script:
    """
    ls *
    """
}

workflow {
    Channel.fromPath("testdir", type:"dir", checkIfExists: true)
    | map { it.listFiles() }
    | take_files
    | view
}

Program output

ERROR ~ Error executing process > 'take_files (1)'

Caused by:
  Not a valid path value type: [Ljava.nio.file.Path; ([/home/Gullumluvl/testdir/a.txt, /home/Gullumluvl/testdir/b.txt])

Environment

  • Nextflow version: 25.03.1-edge
  • Java version: OpenJDK 64-Bit Server VM 21.0.7+6-Debian-1
  • Operating system: Debian 13 Linux 6.12.27-amd64

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