# Nxf\_unstage\_output(): ls fails when dealing with very large number of files

**URL:** <https://community.seqera.io/t/nxf-unstage-output-ls-fails-when-dealing-with-very-large-number-of-files/2761>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [September 11, 2026, 1:44pm UTC](https://community.seqera.io/t/nxf-unstage-output-ls-fails-when-dealing-with-very-large-number-of-files/2761 "2026-09-11T13:44:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheoG](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/theog/32/2481_2.png) [@TheoG](https://community.seqera.io/u/TheoG)\
**Post date:** [September 11, 2026, 1:44pm UTC](https://community.seqera.io/t/nxf-unstage-output-ls-fails-when-dealing-with-very-large-number-of-files/2761/1 "2026-09-11T13:44:15Z")

</div>

Hello,

A bug I encountered when running my pipeline on a large dataset.

The failing process is dockerized (hence the staging in/out) and exports a bunch of files through globing:

```bash
    output:

    path("${params.repref_dir}/*/REF-*.gbk", emit: repref_gbk)

```

`nxf_stage_output()` fails at the `eval "ls ..."` step with error

```bash
.command.run: line 24521: /usr/bin/ls: Argument list too long

```

- I am a bit surprised as I expect about ~66k files from this command, which do not seem _that_ much.
- I could stage about ~24k files in without any issue

I could circumvent the error by parallelising this process, so that a smaller number of files is created by each process.

From my understanding there isn’t much that could be done to prevent this issue as it is caused by the underlying OS (maybe add some warning in the documentation about globing when expecting a large number of outputs?), but I though it might still be worth bringing it to your attention.

Cheers,

Theo

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [September 11, 2026, 2:29pm UTC](https://community.seqera.io/t/nxf-unstage-output-ls-fails-when-dealing-with-very-large-number-of-files/2761/2 "2026-09-11T14:29:31Z")

</div>

Please open this as a GitHub issue on the Nextflow repo instead 🙏

---

<div class="post-metadata">

**Author:** ![Alexander\_Nater](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/alexander_nater/32/552_2.png) [@Alexander\_Nater](https://community.seqera.io/u/Alexander_Nater)\
**Post date:** [September 15, 2026, 12:01pm UTC](https://community.seqera.io/t/nxf-unstage-output-ls-fails-when-dealing-with-very-large-number-of-files/2761/3 "2026-09-15T12:01:01Z")

</div>

As far as I remember, this is well known issue. You could just put your output files into a tar or zip archive and emit that.
