Metadata file path doesn't exist when generating core diversity metrics

Hello,

I’m new to Qiime2 and working with a small practice dataset to get a handle on the basics. When I try to generate core diversity metrics, I get an error that the metadata file path doesn’t exist. The metadata file is in the correct format, validated with Keemei, located in the working directory, and has read permissions. It’s a very simple txt file with sample IDs and two categorical variables. All the files are located locally on the computer (macOS Tahoe) in the working directory, and I’m running qiime2-amplicon-2024.10.

Command code:

qiime diversity core-metrics-phylogenetic
--i-phylogeny rooted-tree.qza
--i-table freq-table.qza
--p-sampling-depth 7000
--m-metadata-file practice1_mapping.txt
--output-dir core-metrics

Error message:

There was an issue with loading the file as metadata:

Metadata file path doesn't exist, or the path points to something other than a file. Please check that the path exists, has read permissions, and points to a regular file (not a directory):

There may be more errors present in the metadata file. To get a full report, sample/feature metadata files can be validated with Keemei: https://keemei.qiime2.org

Find details on QIIME 2 metadata requirements here: Metadata in QIIME 2 — QIIME 2 2024.10.1 documentation

For what it’s worth, I have no issues with the same metadata file when running:

qiime metadata tabulate
--m-input-file practice1_mapping.txt
--o-visualization tabulated-sample-metadata.qzv

Any help or guidance is appreciated!

Hello @clacour1,

Welcome to the forums! :qiime2:

Looks like you are doing everything right...
This might be one of those spooky problems :ghost:
Hopefully the computer is just being a turkey :turkey:

Can you replicate the ' Metadata file path doesn't exist' error, then run this:

open .

That will open the current working directory in the default app, which is Finder.

What do you see inside after you get the error, or do you get the error at all?
You can share a screenshot :camera_flash:

Thank you for your reply!

I replicated the error and ran what you suggested, and it opened Finder to the current working directory highlighting the metadata file.

1 Like

Can you run stat practice1_mapping.txt and post the output here? And can you confirm that qiime metadata tabulate does work and qiime diversity core-metrics-phylogenetic does not work back-to-back in the same terminal and post a screenshot of that here? There may be a problem with the file's permissions, but I would expect that to cause all commands to fail. Very unusual for one command to succeed and the other to explode.

1 Like

Thank you for your reply! It does seem very unusual.

This is the output:

1 Like

I am baffled... Is there any chance you can update to a newer version of QIIME 2 and try that? If not, or if that doesn't work, can you DM me your metadata file? I am entirely unable to replicate this in the latest version of QIIME 2 or in 2024.10. There may be something very obvious I'm missing, or there could be something particular to that file.

Can you upload this file to the forums?
image

I’m glad I’m not the only one baffled haha I tried on qiime2-amplicon-2025.4 and qiime2-amplicon-2025.10, and I got the same error.

This is the metadata file:

practice1_mapping.txt (84 Bytes)

This is the tabulated-sample-metadata.qzv file:

tabulated-sample-metadata.qzv (1.2 MB)

1 Like

Something unusual I'm only just noticing about this. The error says

There was an issue with loading the file as metadata:

It appears to have a few spaces or maybe a tab where the filename ought to be. This error is happening before the Action is invoked at all it's happening while we are pre-processing the input. In other words, both core-metrics-phylogenetic and metadata tabulate are running the code that's causing the error so both ought to raise the error. I still can't make it happen, even with your file.

When I run core-metrics-phylogenetic with your metadata file, I get an expected error that none of my sample identifiers match, which means I am past where your error is being produced. For it to tell me that, it actually has to read the metadata file, which is failing for you.

I guess can you post the table and the tree you're using? That really shouldn't matter for this error, but I'm still at a loss as to what is happening here.

That’s a good catch! I also don’t get the error when I use the same metadata file for feature-table summarize and diversity alpha-rarefaction.

Here are the table and tree:

freq-table.qza (16.8 KB)

rooted-tree.qza (43.3 KB)

1 Like

Hi @clacour1,
I tried running the command with the data you provide, and it ran with no issues.

Can you move all the files for core-metrics into a new dir and try again?

To @Oddant1's point, if I put the wrong metadata name the error tells me what metadata is missing. Here is says There was an issue with loading the file practice1_mapping_file1.txt as metadata: This makes me think this is a weird formating issue.

Have you tried re-writing the command by hand and re-running?

I am sorry to not have more information for you.
Hope this helps!

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