# Dada2 Error: return code 1

**URL:** https://forum.qiime2.org/t/dada2-error-return-code-1/25711
**Category:** Technical Support
**Created:** [March 8, 2023, 8:46am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711 "2023-03-08T08:46:11Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Pratibha\_Kadam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pratibha_kadam/32/15124_2.png) [@Pratibha\_Kadam](https://forum.qiime2.org/u/Pratibha_Kadam)
#### Post date: [March 8, 2023, 8:46am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/1 "2023-03-08T08:46:11Z")

</div>

Hello There,  
I am using 6 samples-16S RNA metagenomics data for analysis. I am using 64 GB RAM system with 16 processors and running ubuntu in windows subsystem.

I have encountered with the (reuturn code 1) error in dada2 step. My data is already filtered and trimmed using cutadapt.

Please see the following command:

qiime dada2 denoise-paired  
--i-demultiplexed-seqs IHF\_37\_paired-end-demux.qza  
--p-trim-left-f 0  
--p-trim-left-r 0  
--p-trunc-len-f 0  
--p-trunc-len-r 0  
--o-representative-sequences IHF\_37\_rep-seqs-dada2.qza  
--o-table table-dada2.qza  
--o-denoising-stats stats-dada2.qza  
--p-n-threads 12

I have installed qiime2 (version:2022)

Ichecked the error in the forum but unable to find the solution for my error.

Error:  
Running external command line application(s). This may print messages to stdout and/or stderr. The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist. Command: run\_dada.R --input\_directory /tmp/tmpwnwjuvx5/forward --input\_directory\_reverse /tmp/tmpwnwjuvx5/reverse --output\_path /tmp/tmpwnwjuvx5/output.tsv.biom --output\_track /tmp/tmpwnwjuvx5/track.tsv --filtered\_directory /tmp/tmpwnwjuvx5/filt\_f --filtered\_directory\_reverse /tmp/tmpwnwjuvx5/filt\_r --truncation\_length 0 --truncation\_length\_reverse 0 --trim\_left 0 --trim\_left\_reverse 0 --max\_expected\_errors 2.0 --max\_expected\_errors\_reverse 2.0 --truncation\_quality\_score 2 --min\_overlap 12 --pooling\_method independent --chimera\_method consensus --min\_parental\_fold 1.0 --allow\_one\_off False --num\_threads 12 --learn\_min\_reads 1000000 R version 4.1.3 (2022-03-10) Loading required package: Rcpp DADA2: 1.22.0 / Rcpp: 1.0.9 / RcppParallel: 5.1.5 2) Filtering Error in filterAndTrim(unfilts, filts, unfiltsR, filtsR, truncLen = c(truncLen, : These are the errors (up to 5) encountered in individual cores... Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 44333 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 1334 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 1081 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 814 Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 9275 Execution halted Traceback (most recent call last): File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 308, in denoise\_paired run\_commands([cmd]) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 36, in run\_commands subprocess.run(cmd, check=True) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['run\_dada.R', '--input\_directory', '/tmp/tmpwnwjuvx5/forward', '--input\_directory\_reverse', '/tmp/tmpwnwjuvx5/reverse', '--output\_path', '/tmp/tmpwnwjuvx5/output.tsv.biom', '--output\_track', '/tmp/tmpwnwjuvx5/track.tsv', '--filtered\_directory', '/tmp/tmpwnwjuvx5/filt\_f', '--filtered\_directory\_reverse', '/tmp/tmpwnwjuvx5/filt\_r', '--truncation\_length', '0', '--truncation\_length\_reverse', '0', '--trim\_left', '0', '--trim\_left\_reverse', '0', '--max\_expected\_errors', '2.0', '--max\_expected\_errors\_reverse', '2.0', '--truncation\_quality\_score', '2', '--min\_overlap', '12', '--pooling\_method', 'independent', '--chimera\_method', 'consensus', '--min\_parental\_fold', '1.0', '--allow\_one\_off', 'False', '--num\_threads', '12', '--learn\_min\_reads', '1000000']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2cli/commands.py", line 339, in **call** results = action(\*\*arguments) File "", line 2, in denoise\_paired File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable outputs = self._callable\_executor_(scope, callable\_args, File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in _callable\_executor_ output\_views = self.\_callable(\*\*view\_args) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 321, in denoise\_paired raise Exception("An error was encountered while running DADA2" Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

---

<div class="post-metadata">

### Author: ![colinvwood](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinvwood/32/17303_2.png) [@colinvwood](https://forum.qiime2.org/u/colinvwood)
#### Post date: [March 8, 2023, 5:47pm UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/3 "2023-03-08T17:47:52Z")

</div>

Hey @Pratibha_Kadam,

Have you run `qiime demux summarize` on your demultiplexed sequences artifact? If so, would you mind sharing the visualization here so we can take a look? If not, would you mind running the command first and then sharing the visualization?

Also, could you run `qiime info` and tell us the exact version of qiime that you have installed?

Thanks!

---

<div class="post-metadata">

### Author: ![Pratibha\_Kadam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pratibha_kadam/32/15124_2.png) [@Pratibha\_Kadam](https://forum.qiime2.org/u/Pratibha_Kadam)
#### Post date: [March 9, 2023, 4:01am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/4 "2023-03-09T04:01:15Z")

</div>

Thank you for your response @colinvwood

Yes! I have demux.qzv, Please find attached.  
[demux.qzv](https://forum.qiime2.org/uploads/short-url/2dtQHvsle39EiW9ZZr5hkG5kb2Z.qzv) (312.7 KB)

qiime info output:

(qiime2-2022) mmmuser\_101@FMR-NGS:/mnt/e/Metagenomics/IHF\_37$ qiime info System versions Python version: 3.8.13 QIIME 2 release: 2022.8 QIIME 2 version: 2022.8.1 q2cli version: 2022.8.0 Installed plugins alignment: 2022.8.0 composition: 2022.8.0 cutadapt: 2022.8.0 dada2: 2022.8.0 deblur: 2022.8.0 demux: 2022.8.0 diversity: 2022.8.0 diversity-lib: 2022.8.0 emperor: 2022.8.0 feature-classifier: 2022.8.0 feature-table: 2022.8.0 fragment-insertion: 2022.8.0 gneiss: 2022.8.0 longitudinal: 2022.8.0 metadata: 2022.8.0 phylogeny: 2022.8.0 quality-control: 2022.8.0 quality-filter: 2022.8.0 sample-classifier: 2022.8.0 taxa: 2022.8.0 types: 2022.8.0 vsearch: 2022.8.0

---

<div class="post-metadata">

### Author: ![colinvwood](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinvwood/32/17303_2.png) [@colinvwood](https://forum.qiime2.org/u/colinvwood)
#### Post date: [March 9, 2023, 4:22pm UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/5 "2023-03-09T16:22:51Z")

</div>

@Pratibha_Kadam,

It looks like you don't have any problems with the quality of your data.

You mentioned that you have 64gb of RAM available, and that you are allocating 12 cores for this step (`--p-n-threads`). Because each of these 12 threads/processes will have its own memory requirements, you may be running out of memory. You could try rerunning this step with say `--p-n-threads` set to to `2` or so. Because you only have six samples, this should still be plenty fast.

Let us know if this fixes the issue!

---

<div class="post-metadata">

### Author: ![Pratibha\_Kadam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pratibha_kadam/32/15124_2.png) [@Pratibha\_Kadam](https://forum.qiime2.org/u/Pratibha_Kadam)
#### Post date: [March 10, 2023, 4:03am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/6 "2023-03-10T04:03:38Z")

</div>

I will run on 3 threads now and let you know.

Hope it works 🤞

Thanks for the quick response.

---

<div class="post-metadata">

### Author: ![Pratibha\_Kadam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pratibha_kadam/32/15124_2.png) [@Pratibha\_Kadam](https://forum.qiime2.org/u/Pratibha_Kadam)
#### Post date: [March 11, 2023, 5:11pm UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/7 "2023-03-11T17:11:48Z")

</div>

@colinvwood  
I tried with 3 threads, it did not work.  
I tried with 2 even that did not work for me.

Well, I guess I have to run the data on 1 thread only.

FYI: For my 1 sample it took 10 days to finish the Dada2 run.

---

<div class="post-metadata">

### Author: ![Pratibha\_Kadam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pratibha_kadam/32/15124_2.png) [@Pratibha\_Kadam](https://forum.qiime2.org/u/Pratibha_Kadam)
#### Post date: [March 13, 2023, 3:46am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/8 "2023-03-13T03:46:10Z")

</div>

I ran Dada2 with one thread only.  
Again it had given the (return code 1) error.

The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist. Command: run\_dada.R --input\_directory /tmp/tmp8t58a7i9/forward --input\_directory\_reverse /tmp/tmp8t58a7i9/reverse --output\_path /tmp/tmp8t58a7i9/output.tsv.biom --output\_track /tmp/tmp8t58a7i9/track.tsv --filtered\_directory /tmp/tmp8t58a7i9/filt\_f --filtered\_directory\_reverse /tmp/tmp8t58a7i9/filt\_r --truncation\_length 0 --truncation\_length\_reverse 0 --trim\_left 0 --trim\_left\_reverse 0 --max\_expected\_errors 2.0 --max\_expected\_errors\_reverse 2.0 --truncation\_quality\_score 2 --min\_overlap 12 --pooling\_method independent --chimera\_method consensus --min\_parental\_fold 1.0 --allow\_one\_off False --num\_threads 1 --learn\_min\_reads 1000000 R version 4.1.3 (2022-03-10) Loading required package: Rcpp DADA2: 1.22.0 / Rcpp: 1.0.9 / RcppParallel: 5.1.5 2) Filtering Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 52358 Execution halted Traceback (most recent call last): File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 308, in denoise\_paired run\_commands([cmd]) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 36, in run\_commands subprocess.run(cmd, check=True) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['run\_dada.R', '--input\_directory', '/tmp/tmp8t58a7i9/forward', '--input\_directory\_reverse', '/tmp/tmp8t58a7i9/reverse', '--output\_path', '/tmp/tmp8t58a7i9/output.tsv.biom', '--output\_track', '/tmp/tmp8t58a7i9/track.tsv', '--filtered\_directory', '/tmp/tmp8t58a7i9/filt\_f', '--filtered\_directory\_reverse', '/tmp/tmp8t58a7i9/filt\_r', '--truncation\_length', '0', '--truncation\_length\_reverse', '0', '--trim\_left', '0', '--trim\_left\_reverse', '0', '--max\_expected\_errors', '2.0', '--max\_expected\_errors\_reverse', '2.0', '--truncation\_quality\_score', '2', '--min\_overlap', '12', '--pooling\_method', 'independent', '--chimera\_method', 'consensus', '--min\_parental\_fold', '1.0', '--allow\_one\_off', 'False', '--num\_threads', '1', '--learn\_min\_reads', '1000000']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2cli/commands.py", line 339, in **call** results = action(\*\*arguments) File "", line 2, in denoise\_paired File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable outputs = self._callable\_executor_(scope, callable\_args, File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in _callable\_executor_ output\_views = self.\_callable(\*\*view\_args) File "/home/mmmuser\_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2\_dada2/\_denoise.py", line 321, in denoise\_paired raise Exception("An error was encountered while running DADA2" Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more. Plugin error from dada2: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

This error seems different than previous one.

Please let me know what to do ahead.

---

<div class="post-metadata">

### Author: ![colinvwood](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinvwood/32/17303_2.png) [@colinvwood](https://forum.qiime2.org/u/colinvwood)
#### Post date: [March 14, 2023, 7:12pm UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/12 "2023-03-14T19:12:16Z")

</div>

@Pratibha_Kadam,

It seems like the issue may not lie with dada2 or the quality of your data. Although you have 64gb of ram on your machine, because you are running a linux subsystem, you only have a subset of that memory available to you. A next step could be to confirm that you have a reasonable amount allocated to the virtual machine.

Because the error seems to be occurring while writing files, another possibility is that you are not running out of storage (disk space). You may also want to check that.

Thanks.

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [April 15, 2023, 1:12am UTC](https://forum.qiime2.org/t/dada2-error-return-code-1/25711/13 "2023-04-15T01:12:28Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
