Plugin error from demux: sample not present in the demultiplexed data

Hello everyone!
I need help because I am stuck with demux filter-samples command. I am working with QIIME 2 version 2022.2.0, installed via Singularity container (I already tried to change the container, problem did not solved).

I have a dataset of 64 samples sequenced and I am trying to run qiime demux filter-samples, after having imported my fastq and subsampled them.
Problem i am facing is that every time I run the command, giving this error:
"Plugin error from demux:
'N' is not a sample present in the demultiplexed data.
Debug info has been saved to /tmp/qiime2-q2cli-err-yw1vlgwk.log"

I placed N because the number change if I try to re-run the command (always ranging between my samples luckily).

The script I ran is:
Singularity> qiime demux filter-samples --i-demux mydataset_subsample.qza --m-metadata-file demux-subsample_temp/per-sample-fastq-counts.tsv --o-filtered-demux mydataset_filtered.qza

I also tried, beyond changing container, to change the metadata file creating an additional one after subsampling, but it does not work.
Thanks in advance for any advice!

Hello @AstroBioJack, could you please rerun the command with the --verbose flag and paste the entire output of the command here? Thank you.

Hey! I was diving into this comment. Seems I have the same problem. Let me give some context, I have two different studies represented in these samples IRS and JMM (the sample id's go: IRS-1,IRS-2,IRS-3;JMM-1, JMM-2, JMM-3 and so on).
After demux, I need to filter the samples with the id's IRS, to do this I used --demux filter-samples and prepared a metadata table excluding all samples IRS's by simply not writing the id name. after running the command, I received an error comment:
Plugin error from demux:
'JMM-62' is not a sample present in the demultiplexed data.
Debug info has been saved to /var/folders/dx/pmzr52tj7yx0cxdsl7zgz0500000gn/T/qiime2-q2cli-err-0fdsnqo5.log

Traceback (most recent call last):
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/indexes/", line 3080, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 4554, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 4562, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'JMM-62'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/q2_demux/", line 39, in filter_samples
forward = manifest.loc[id].forward
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/", line 895, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/", line 1124, in _getitem_axis
return self._get_label(key, axis=axis)
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/", line 1073, in _get_label
return self.obj.xs(label, axis=axis)
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/", line 3739, in xs
loc = index.get_loc(key)
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/pandas/core/indexes/", line 3082, in get_loc
raise KeyError(key) from err
KeyError: 'JMM-62'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/q2cli/", line 329, in call
results = action(**arguments)
File "", line 2, in filter_samples
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/qiime2/sdk/", line 244, in bound_callable
outputs = self.callable_executor(scope, callable_args,
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/qiime2/sdk/", line 390, in callable_executor
output_views = self._callable(**view_args)
File "/Users/jorgemontiel/opt/miniconda3/envs/qiime2-2021.4/lib/python3.8/site-packages/q2_demux/", line 47, in filter_samples
raise ValueError(f'{id!r} is not a sample present in the '
ValueError: 'JMM-62' is not a sample present in the demultiplexed data.

any advise? thank you!

Ok I finally made it work. What I did is, to follow the "Atacama' tutorial, in the section about filtering samples by sequence count. The key was that I had to export the artifact .qzv reporting the demultiplexed data (visual artifact for qiime2 view). The result in a directory with the file 'per-sample-fastq-counts.tsv' and that is the one I modified by erasing the samples that I do not need.

qiime tools export
--input-path demux.qzv
--output-path ./demux-subsample/

qiime demux filter-samples
--i-demux demux-subsample.qza
--m-metadata-file ./demux-subsample/per-sample-fastq-counts.tsv
--o-filtered-demux demux.qza