dada2 error: An error was encountered while running DADA2 in R (return code 1)

My command was:
qiime dada2 denoise-paired --i-demultiplexed-seqs paired-end-demux.qza --p-trim-left-f 17 --p-trim-left-r 21 --p-trunc-len-f 300 --p-trunc-len-r 277 --o-representative-sequences rep-seqs-dada2.qza --o-table table-dada2.qza --o-denoising-stats stats-dada2.qza --output-dir temp --p-n-threads 4 --verbose

The error message was:
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 /tmp/tmpdg3pt17b/forward /tmp/tmpdg3pt17b/reverse /tmp/tmpdg3pt17b/output.tsv.biom /tmp/tmpdg3pt17b/track.tsv /tmp/tmpdg3pt17b/filt_f /tmp/tmpdg3pt17b/filt_r 300 277 17 21 2.0 2 consensus 1.0 4 1000000

R version 3.5.1 (2018-07-02)
Loading required package: Rcpp
DADA2: 1.10.0 / Rcpp: 1.0.1 / RcppParallel: 4.4.2

  1. Filtering Error in names(answer) <- names1 :
    ‘names’ attribute [36] must be the same length as the vector [9]
    Execution halted
    Traceback (most recent call last):
    File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 231, in denoise_paired
    run_commands([cmd])
    File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 36, in run_commands
    subprocess.run(cmd, check=True)
    File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/subprocess.py”, line 418, in run
    output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command ‘[‘run_dada_paired.R’, ‘/tmp/tmpdg3pt17b/forward’, ‘/tmp/tmpdg3pt17b/reverse’, ‘/tmp/tmpdg3pt17b/output.tsv.biom’, ‘/tmp/tmpdg3pt17b/track.tsv’, ‘/tmp/tmpdg3pt17b/filt_f’, ‘/tmp/tmpdg3pt17b/filt_r’, ‘300’, ‘277’, ‘17’, ‘21’, ‘2.0’, ‘2’, ‘consensus’, ‘1.0’, ‘4’, ‘1000000’]’ returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2cli/commands.py”, line 311, in call
results = action(**arguments)
File “</opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/decorator.py:decorator-gen-451>”, line 2, in denoise_paired
File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 231, in bound_callable
output_types, provenance)
File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 365, in callable_executor
output_views = self._callable(**view_args)
File “/opt/conda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 246, 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.

Any help will be appreciated! Thanks.

Hi @eri5n! Please see this post for more details: DADA2 Error Return code 1

Thanks, I looked into the link and as suggested, I have installed the latest version (2019.7) and checked the core number. However the result was almost same. Please find in below the error log:

The command:

qiime dada2 denoise-paired --i-demultiplexed-seqs paired-end-demux.qza --p-trim-left-f 17 --p-trim-left-r 21 --p-trunc-len-f 280 --p-trunc-len-r 220 --o-representative-sequences rep-seqs-dada2.qza --o-table table-dada2.qza --o-denoising-stats stats-dada2.qza --output-dir temp --p-n-threads 3 --verbose

The 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_paired.R /tmp/tmph54m_4tr/forward /tmp/tmph54m_4tr/reverse /tmp/tmph54m_4tr/output.tsv.biom /tmp/tmph54m_4tr/track.tsv /tmp/tmph54m_4tr/filt_f /tmp/tmph54m_4tr/filt_r 280 220 17 21 2.0 2.0 2 consensus 1.0 3 1000000

R version 3.5.1 (2018-07-02)
Loading required package: Rcpp
DADA2: 1.10.0 / Rcpp: 1.0.2 / RcppParallel: 4.4.3

  1. Filtering Error in names(answer) <- names1 :
    ‘names’ attribute [2] must be the same length as the vector [1]
    Execution halted
    Traceback (most recent call last):
    File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 234, in denoise_paired
    run_commands([cmd])
    File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 36, in run_commands
    subprocess.run(cmd, check=True)
    File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/subprocess.py”, line 418, in run
    output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command ‘[‘run_dada_paired.R’, ‘/tmp/tmph54m_4tr/forward’, ‘/tmp/tmph54m_4tr/reverse’, ‘/tmp/tmph54m_4tr/output.tsv.biom’, ‘/tmp/tmph54m_4tr/track.tsv’, ‘/tmp/tmph54m_4tr/filt_f’, ‘/tmp/tmph54m_4tr/filt_r’, ‘280’, ‘220’, ‘17’, ‘21’, ‘2.0’, ‘2.0’, ‘2’, ‘consensus’, ‘1.0’, ‘3’, ‘1000000’]’ returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/q2cli/commands.py”, line 327, in call
results = action(**arguments)
File “</opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/decorator.py:decorator-gen-459>”, line 2, in denoise_paired
File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 240, in bound_callable
output_types, provenance)
File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 383, in callable_executor
output_views = self._callable(**view_args)
File “/opt/conda/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 249, 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.

I would be most grateful if anyone has a hint to solve this problem. Thank you.

Hi @eri5n — the issue linked to in the forum post I sent you goes into a bit of detail about this, but basically the error you are seeing is because you are running out of available memory. You will need to run with fewer threads (and even then, you still might not have enough memory). How much RAM do you have available to you?

Thank you for the reply.
I have 64 Gb RAM and 6 cores.

Hi @eri5n! Hmm, that sounds like more than enough memory for this to work… Are you running in docker or a VM, by any chance? If so, it is possible that the environment isn’t exposing all 64 GB of memory to you.