# Self-consistency loop terminated before convergence.An error was encountered while running DADA2 in R (return code 1)

**URL:** https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532
**Category:** User Support
**Tags:** dada2
**Created:** [March 23, 2018, 2:55pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532 "2018-03-23T14:55:02Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![will](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://forum.qiime2.org/u/will)
#### Post date: [March 23, 2018, 2:55pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/1 "2018-03-23T14:55:02Z")

</div>

Hello,  
I have been getting the following error after the denoising step:

> An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

I use this command:

> qiime dada2 denoise-paired --i-demultiplexed-seqs paired-end-demux.qza --o-table table --o-representative-sequences rep-seqs --p-trim-left-f 5 --p-trim-left-r 5 --p-trunc-len-f 205 --p-trunc-len-r 205

I check the error log:

> cat /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/qiime2-q2cli-err-59qisupk.log  
> 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\_paired.R /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/forward /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/reverse /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/output.tsv.biom /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/filt\_f /var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/filt\_r 205 205 5 5 2.0 2 consensus 1.0 1 1000000
> 
> R version 3.4.1 (2017-06-30)  
> 载入需要的程辑包：Rcpp  
> DADA2 R package version: 1.6.0
> 
> 1. Filtering ................
> 
> 2. Learning Error Rates  
> 2a) Forward Reads  
> Initializing error rates to maximum possible estimate.  
> Sample 1 - 148403 reads in 51229 unique sequences.  
> Sample 2 - 145240 reads in 53221 unique sequences.  
> Sample 3 - 143196 reads in 51653 unique sequences.  
> Sample 4 - 141675 reads in 50840 unique sequences.  
> Sample 5 - 141552 reads in 49282 unique sequences.  
> Sample 6 - 140356 reads in 50312 unique sequences.  
> Sample 7 - 138208 reads in 42132 unique sequences.  
> Sample 8 - 145817 reads in 50908 unique sequences.  
> selfConsist step 2  
> selfConsist step 3  
> selfConsist step 4  
> selfConsist step 5  
> selfConsist step 6  
> selfConsist step 7  
> selfConsist step 8  
> selfConsist step 9  
> selfConsist step 10  
> Self-consistency loop terminated before convergence.  
> 2b) Reverse Reads  
> Initializing error rates to maximum possible estimate.  
> Sample 1 - 148403 reads in 51229 unique sequences.  
> Sample 2 - 145240 reads in 53221 unique sequences.  
> Sample 3 - 143196 reads in 51653 unique sequences.  
> Sample 4 - 141675 reads in 50840 unique sequences.  
> Sample 5 - 141552 reads in 49282 unique sequences.  
> Sample 6 - 140356 reads in 50312 unique sequences.  
> Sample 7 - 138208 reads in 42132 unique sequences.  
> Sample 8 - 145817 reads in 50908 unique sequences.  
> selfConsist step 2  
> selfConsist step 3  
> selfConsist step 4  
> selfConsist step 5  
> selfConsist step 6  
> selfConsist step 7  
> selfConsist step 8  
> selfConsist step 9  
> selfConsist step 10  
> Self-consistency loop terminated before convergence.
> 
> 3. Denoise remaining samples ........
> 
> 4. Remove chimeras (method = consensus)  
> Error in isBimeraDenovoTable(unqs[[i]], ..., verbose = verbose) :  
> Input must be a valid sequence table.  
> Calls: removeBimeraDenovo -\> isBimeraDenovoTable  
> 此外: Warning message:  
> In is.na(colnames(unqs[[i]])) : is.na()不适用于类别为'NULL'的非串列或非矢量  
> 停止执行  
> Traceback (most recent call last):  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2\_dada2/\_denoise.py", line 179, in denoise\_paired  
> run\_commands([cmd])  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2\_dada2/\_denoise.py", line 35, in run\_commands  
> subprocess.run(cmd, check=True)  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/subprocess.py", line 398, in run  
> output=stdout, stderr=stderr)  
> subprocess.CalledProcessError: Command '['run\_dada\_paired.R', '/var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/forward', '/var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/reverse', '/var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/output.tsv.biom', '/var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/filt\_f', '/var/folders/py/xrlp2jks4jq1kqx3mwf99tk80000gn/T/tmp1u\_\_19zv/filt\_r', '205', '205', '5', '5', '2.0', '2', 'consensus', '1.0', '1', '1000000']' returned non-zero exit status 1
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2cli/commands.py", line 246, in **call**  
> results = action(\*\*arguments)  
> File "", line 2, in denoise\_paired  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/action.py", line 228, in bound\_callable  
> output\_types, provenance)  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/action.py", line 363, in _callable\_executor_  
> output\_views = self.\_callable(\*\*view\_args)  
> File "/Users/mac/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2\_dada2/\_denoise.py", line 194, in denoise\_paired  
> " and stderr to learn more." % e.returncode)  
> Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

It would be great if anyone could guide me.  
The qiime 2 version that am using is qiime2 2018.02 and my R version is also 3.4.2 (2017-09-28)

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [March 23, 2018, 3:49pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/2 "2018-03-23T15:49:59Z")

</div>



---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [March 23, 2018, 5:24pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/3 "2018-03-23T17:24:51Z")

</div>

> [@will](#):
>
> Self-consistency loop terminated before convergence

Hi @will, see [this forum thread](https://forum.qiime2.org/t/dada2-error-return-code-1-paired-end-seqs/2680) it looks like you may be running into the same issue.

Good luck!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [March 23, 2018, 5:24pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/4 "2018-03-23T17:24:52Z")

</div>



---

<div class="post-metadata">

### Author: ![will](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://forum.qiime2.org/u/will)
#### Post date: [March 26, 2018, 2:59pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/5 "2018-03-26T14:59:07Z")

</div>

Thank you so much.  
I have tried making a new temporary environment and running multiple threads in my project. But it still doesn't work. The result gave the same error log.😓

the is my command:

> qiime dada2 denoise-paired \
> 
> > --p-n-threads 50   
> > --i-demultiplexed-seqs paired-end-demux.qza   
> > --o-table table   
> > --o-representative-sequences rep-seqs   
> > --p-trim-left-f 0   
> > --p-trim-left-r 0   
> > --p-trunc-len-f 230   
> > --p-trunc-len-r 230

could everyone help me to fix it?

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [March 26, 2018, 3:01pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/6 "2018-03-26T15:01:35Z")

</div>



---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [March 26, 2018, 3:36pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/7 "2018-03-26T15:36:06Z")

</div>

@will,

> [@will](#):
>
> The result gave the same error log

So still an error with return code 1? Or just the self-consistency loop error? If just the latter, check [this thread](https://forum.qiime2.org/t/dada2-self-consistency-loop-terminated-before-convergence/1716) — the self-consistency loop might not always be a problem (but the job crashing with error code 1 is).

How long is the job taking to run before it errors?

If you are still getting a job failure with exit code 1, see [this thread](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-please-inspect-stdout-and-stderr-to-learn-more/1938) (or search for others on this forum) — it looks like this issue often occurs if dada2 parameters are not set appropriately — e.g., if reads do not merge.

If that does not work, could you please post your demultiplexed read quality summaries here (in case this is related to dada2 parameters that you are setting/read quality)? We can take a look at these settings.

Thanks!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [March 26, 2018, 3:36pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/8 "2018-03-26T15:36:08Z")

</div>



---

<div class="post-metadata">

### Author: ![will](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://forum.qiime2.org/u/will)
#### Post date: [April 3, 2018, 12:16pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/9 "2018-04-03T12:16:46Z")

</div>

Thank you so much. My problem is fixed after I choose to remain the low quality reads. I found that there will be a problem when I cut more. when I set --p-trunc-len-r/f 150, it does not work, when I set --p-trunc-len-r/f 225, I works and costs less time.

---

<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: [May 4, 2018, 6:16pm UTC](https://forum.qiime2.org/t/self-consistency-loop-terminated-before-convergence-an-error-was-encountered-while-running-dada2-in-r-return-code-1/3532/10 "2018-05-04T18:16:47Z")

</div>

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