DADA2 plugin error during paired-end denoising (R return code 1)

After running the qiime dada2 denoise-paired command with truncation lengths set to 250 bp for both forward and reverse reads, the analysis fails with the following error:

Plugin error from dada2: An error was encountered while running DADA2 in R (return code 1). Please inspect stdout and stderr to learn more.

Here is the exact command I executed:

qiime dada2 denoise-paired \
  --i-demultiplexed-seqs paired-end-demux.qza \
  --p-trim-left-f 21 \
  --p-trim-left-r 20 \
  --p-trunc-len-f 250 \
  --p-trunc-len-r 250 \
  --p-n-threads 8 \
  --o-table 16S-table.qza \
  --o-representative-sequences 16S-rep-seqs.qza \
  --o-denoising-stats 16S-denoising-stats.qza \
  --verbose

QIIME 2 version: 2024.10
Installation method: Conda environment (qiime2-amplicon-2024.10)

Could you please help me understand why this error occurs and how I can resolve it?

Hi @Pelin_Kaplan,

Welcome to the :qiime2: forum :waving_hand:

Could you please copy and paste the entire traceback from your terminal (including your full command)? This will help us better determine where the issue lies. Thanks! :lizard:

(qiime2-amplicon-2024.10) pelin@LAPTOP-45GH5C0T:~$ cd denemey
(qiime2-amplicon-2024.10) pelin@LAPTOP-45GH5C0T:~/denemey$ qiime dada2 denoise-paired
--i-demultiplexed-seqs paired-end-demux.qza
--p-trim-left-f 21
--p-trim-left-r 20
--p-trunc-len-f 250
--p-trunc-len-r 250
--p-n-threads 8
--o-table 16S-table.qza
--o-representative-sequences 16S-rep-seqs.qza
--o-denoising-stats 16S-denoising-stats.qza
--verbose
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/tmpeca7klbu/forward --input_directory_reverse /tmp/tmpeca7klbu/reverse --output_path /tmp/tmpeca7klbu/output.tsv.biom --output_track /tmp/tmpeca7klbu/track.tsv --filtered_directory /tmp/tmpeca7klbu/filt_f --filtered_directory_reverse /tmp/tmpeca7klbu/filt_r --truncation_length 250 --truncation_length_reverse 250 --trim_left 21 --trim_left_reverse 20 --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 8 --learn_min_reads 1000000

R version 4.3.3 (2024-02-29)
Loading required package: Rcpp
DADA2: 1.30.0 / Rcpp: 1.0.13.1 / RcppParallel: 5.1.9
2) Filtering Error in names(answer) <- names1 :
'names' attribute [4] must be the same length as the vector [3]
4: mcmapply(fastqPairedFilter, mapply(c, fwd, rev, SIMPLIFY = FALSE),
mapply(c, filt, filt.rev, SIMPLIFY = FALSE), MoreArgs = list(truncQ = truncQ,
truncLen = truncLen, trimLeft = trimLeft, trimRight = trimRight,
maxLen = maxLen, minLen = minLen, maxN = maxN, minQ = minQ,
maxEE = maxEE, rm.phix = rm.phix, rm.lowcomplex = rm.lowcomplex,
orient.fwd = orient.fwd, matchIDs = matchIDs, id.sep = id.sep,
id.field = id.field, n = n, OMP = OMP, qualityType = qualityType,
compress = compress, verbose = verbose), mc.cores = ncores,
mc.silent = TRUE)
3: filterAndTrim(unfilts, filts, unfiltsR, filtsR, truncLen = c(truncLen,
truncLenR), trimLeft = c(trimLeft, trimLeftR), maxEE = c(maxEE,
maxEER), truncQ = truncQ, rm.phix = TRUE, multithread = multithread)
2: withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
1: suppressWarnings(filterAndTrim(unfilts, filts, unfiltsR, filtsR,
truncLen = c(truncLen, truncLenR), trimLeft = c(trimLeft,
trimLeftR), maxEE = c(maxEE, maxEER), truncQ = truncQ,
rm.phix = TRUE, multithread = multithread))
Traceback (most recent call last):
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 353, in denoise_paired
run_commands([cmd])
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 38, in run_commands
subprocess.run(cmd, check=True)
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/tmp/tmpeca7klbu/forward', '--input_directory_reverse', '/tmp/tmpeca7klbu/reverse', '--output_path', '/tmp/tmpeca7klbu/output.tsv.biom', '--output_track', '/tmp/tmpeca7klbu/track.tsv', '--filtered_directory', '/tmp/tmpeca7klbu/filt_f', '--filtered_directory_reverse', '/tmp/tmpeca7klbu/filt_r', '--truncation_length', '250', '--truncation_length_reverse', '250', '--trim_left', '21', '--trim_left_reverse', '20', '--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', '8', '--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/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 530, in call
results = self._execute_action(
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 602, in _execute_action
results = action(**arguments)
File "", line 2, in denoise_paired
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 299, in bound_callable
outputs = self.callable_executor(
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 570, in callable_executor
output_views = self._callable(**view_args)
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 366, 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.

See above for debug info.
(qiime2-amplicon-2024.10) pelin@LAPTOP-45GH5C0T:~/denemey$ qiime dada2 denoise-paired \d
--i-demultiplexed-seqs paired-end-demux.qza
--p-trim-left-f 21
--p-trim-left-r 20
--p-trunc-len-f 260
--p-trunc-len-r 220
--p-n-threads 8
--o-table 16S-table.qza
--o-representative-sequences 16S-rep-seqs.qza
--o-denoising-stats 16S-denoising-stats.qza
--verbose
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/tmp1dixpgzs/forward --input_directory_reverse /tmp/tmp1dixpgzs/reverse --output_path /tmp/tmp1dixpgzs/output.tsv.biom --output_track /tmp/tmp1dixpgzs/track.tsv --filtered_directory /tmp/tmp1dixpgzs/filt_f --filtered_directory_reverse /tmp/tmp1dixpgzs/filt_r --truncation_length 260 --truncation_length_reverse 220 --trim_left 21 --trim_left_reverse 20 --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 8 --learn_min_reads 1000000

R version 4.3.3 (2024-02-29)
Loading required package: Rcpp
DADA2: 1.30.0 / Rcpp: 1.0.13.1 / RcppParallel: 5.1.9
2) Filtering Error in names(answer) <- names1 :
'names' attribute [4] must be the same length as the vector [3]
4: mcmapply(fastqPairedFilter, mapply(c, fwd, rev, SIMPLIFY = FALSE),
mapply(c, filt, filt.rev, SIMPLIFY = FALSE), MoreArgs = list(truncQ = truncQ,
truncLen = truncLen, trimLeft = trimLeft, trimRight = trimRight,
maxLen = maxLen, minLen = minLen, maxN = maxN, minQ = minQ,
maxEE = maxEE, rm.phix = rm.phix, rm.lowcomplex = rm.lowcomplex,
orient.fwd = orient.fwd, matchIDs = matchIDs, id.sep = id.sep,
id.field = id.field, n = n, OMP = OMP, qualityType = qualityType,
compress = compress, verbose = verbose), mc.cores = ncores,
mc.silent = TRUE)
3: filterAndTrim(unfilts, filts, unfiltsR, filtsR, truncLen = c(truncLen,
truncLenR), trimLeft = c(trimLeft, trimLeftR), maxEE = c(maxEE,
maxEER), truncQ = truncQ, rm.phix = TRUE, multithread = multithread)
2: withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
1: suppressWarnings(filterAndTrim(unfilts, filts, unfiltsR, filtsR,
truncLen = c(truncLen, truncLenR), trimLeft = c(trimLeft,
trimLeftR), maxEE = c(maxEE, maxEER), truncQ = truncQ,
rm.phix = TRUE, multithread = multithread))
Traceback (most recent call last):
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 353, in denoise_paired
run_commands([cmd])
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 38, in run_commands
subprocess.run(cmd, check=True)
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/tmp/tmp1dixpgzs/forward', '--input_directory_reverse', '/tmp/tmp1dixpgzs/reverse', '--output_path', '/tmp/tmp1dixpgzs/output.tsv.biom', '--output_track', '/tmp/tmp1dixpgzs/track.tsv', '--filtered_directory', '/tmp/tmp1dixpgzs/filt_f', '--filtered_directory_reverse', '/tmp/tmp1dixpgzs/filt_r', '--truncation_length', '260', '--truncation_length_reverse', '220', '--trim_left', '21', '--trim_left_reverse', '20', '--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', '8', '--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/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 530, in call
results = self._execute_action(
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 602, in _execute_action
results = action(**arguments)
File "", line 2, in denoise_paired
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 299, in bound_callable
outputs = self.callable_executor(
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 570, in callable_executor
output_views = self._callable(**view_args)
File "/home/pelin/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 366, 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.

See above for debug info.

:thinking: :face_with_monocle:


Thanks for posting all of that. Try rerunning with --p-n-threads 4 or maybe even --p-n-threads 2. That will take longer, but reduce the memory footprint so it can finish.

And while I'm giving advice, install the new version of Qiime2!