We've moved!
You can find our new documentation site and support forum for posting questions here.

Argument list too long

I have a task that tries to merge lots of files from a scatter. I'm getting the error: /cromwell_root/script: line 25: /usr/bin/java: Argument list too long. Is there anything I can do to make this work? Thanks.


  • SChaluvadiSChaluvadi Member, Broadie, Moderator admin

    @jgould I will see if I can find out why this is happening and how to get around it!

  • mcovarrmcovarr Cambridge, MAMember, Broadie, Dev ✭✭

    Hi @jgould it sounds like it's your command taking issue with the number of files and not Cromwell. Could you provide some more details to see if we can find a way around this? If you could attach the command script that would be very helpful. Thanks!

  • jgouldjgould GouldMember ✭✭

    Here's my task. Just curious how you can tell it's my task and not Cromwell that has the issue with the command line length? Thanks.

    task MergeSamFiles {
    Array[File] input_bams
    String base_output_file_name
    String output_bam_name = "${base_output_file_name}.bam"
    String output_bam_index_name = "${base_output_file_name}.bai"
    Int preemptible_tries
    Float bam_size
    String output_directory

    command {
        set -e
        java -jar /picard.jar MergeSamFiles \
            SORT_ORDER=coordinate \
            INPUT=${sep=' INPUT=' input_bams} \
            OUTPUT=${output_bam_name} \


  • mcovarrmcovarr Cambridge, MAMember, Broadie, Dev ✭✭

    In the error message /cromwell_root/script: line 25: /usr/bin/java: Argument list too long it looks like script is reporting that the command java is failing with Argument list too long. Do you know how many BAMs are in input_bams?

  • jgouldjgould GouldMember ✭✭

    3,805. I think the generated cromwell script can set the maximum stack size using ulimit -s to enable longer command lines. Thanks.

  • SChaluvadiSChaluvadi Member, Broadie, Moderator admin

    @jgould Just wanted to check in and make sure that you were able to resolve this error as we are going to close this ticket! Let us know!

  • jgouldjgould GouldMember ✭✭

    I was able to resolve the issue by adding ulimit -s unlimited to my task command line.

  • AdelaideRAdelaideR Member admin

    @jgould thanks for the update, that will be helpful for other forum users.

Sign In or Register to comment.