# Troubleshooting an error (exit code 1) when performing BWA-MEM2 on WGS data

**URL:** <https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387>\
**Category:** usegalaxy.org support\
**Tags:** troubleshooting\
**Created:** [July 28, 2022, 2:48pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387 "2022-07-28T14:48:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![edf393](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@edf393](https://help.galaxyproject.org/u/edf393)\
**Post date:** [July 28, 2022, 2:48pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387/1 "2022-07-28T14:48:20Z")

</div>

Hello,

I attempted to input two WGS data sets (two different sets of reads) and a reference genome from NCBI into the BWA-MEM2 tool. The job failed and resulting in the following messages:

Execution resulted in the following messages:  
_Fatal error: Exit code 1 ()_

Tool generated the following standard error:  
_Looking to launch executable “/usr/local/bin/bwa-mem2.avx2”, simd = .avx2_  
_Launching executable “/usr/local/bin/bwa-mem2.avx2”_  
_[bwa\_index] Pack FASTA… 22.12 sec_  
\*\* Entering FMI\_search\*  
_init ticks = 173525096758_  
_ref seq len = 5422419662_  
_binary seq ticks = 119852397722_  
_Allocation of 40.40 GB for suffix\_array failed._  
_Current Allocation = 45.45 GB_

If it helps troubleshoot this issue, I have included some information about the job and the parameters used below.

---

<div class="post-metadata">

**Author:** ![edf393](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@edf393](https://help.galaxyproject.org/u/edf393)\
**Post date:** [July 28, 2022, 2:50pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387/2 "2022-07-28T14:50:12Z")

</div>

BWA-MEM2 on data 1, data 8, and data 5 (mapped reads in BAM format)  
Dbkey: bosTau9  
Format: bam

Galaxy Tool ID: toolshed.g2.bx.psu.edu/repos/iuc/bwa\_mem2/bwa\_mem2/2.2.1+galaxy0

Tool Parameters  
_Will you select a reference genome from your history or use a built-in index?_  
History

_Use the following dataset as the reference sequence_  
Data 5: fasta.gz, 1957 sequences, 801.4 MB, bosTau9

_Single or Paired-end reads_  
Paired

_Select first set of reads_  
Data 8: fastqsanger.gz, 25.2GB, bosTau9

_Select second set of reads_  
Data 1: fastqsanger.gz, 25.7 GB, bosTau9

_Enter mean, standard deviation, max, and min for insert lengths._  
150

_Set read groups information?_  
Do not set

_Select analysis mode_  
Illumina

_BAM sorting mode_  
Sort by chromosomal coordinates

_Job Resource Parameters_  
No

Job Metrics  
Cores Allocated: 10  
Memory Allocated (MB) 29995  
Job Runtime (Wall Clock): 6 minutes

meminfo  
Total System Memory: 28.6 GB  
Total System Swap: 0 bytes

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [July 29, 2022, 7:05pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387/3 "2022-07-29T19:05:14Z")

</div>

Hi @edf393

The FAQs explain what you can do in general to continue working at a public Galaxy server. In short: use an indexed genome as the mapping target (`bosTau8` instead) + split the query reads into a collection, run some QA, map, then merge the results.

Or, you can consider setting up a private Galaxy server with scaled up resources.

Details:

- The job failed for exceeding memory limits at the public Galaxy server [FAQ](https://training.galaxyproject.org/training-material/faqs/galaxy/#understanding-exceeds-memory-allocation-error-messages).
- Specifically:
  - The fastq datasets are too large – ~25 GB compressed per end. [FAQ](https://training.galaxyproject.org/training-material/faqs/galaxy/#working-with-very-large-fastq-datasets)
  - The fasta custom genome is too large, plus has a formatting problem. [FAQ](https://training.galaxyproject.org/training-material/faqs/galaxy/#working-with-very-large-fasta-datasets)

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [September 20, 2023, 9:00pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387/4 "2023-09-20T21:00:19Z")

</div>

A post was split to a new topic: [Troubleshooting BWA-MEM2 resources under Docker Galaxy](https://help.galaxyproject.org/t/troubleshooting-bwa-mem2-resources-under-docker-galaxy/10819)

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [September 20, 2023, 9:00pm UTC](https://help.galaxyproject.org/t/troubleshooting-an-error-exit-code-1-when-performing-bwa-mem2-on-wgs-data/8387/5 "2023-09-20T21:00:26Z")

</div>


