State 3.0 is not represented by any members of 0 group in metadata. Consider using a different group_column or state value.
Strangely, I don't have problem with longitudinal pairwise-differences which takes almost the same data (except the distance matrix replaced by shannon vector):
I have conducted additional tests.
I believe I have solved my problem by keeping only the same samples between the mapping file and the distance matrix. I don't have to do that with longitudinal pairwise differences, perhaps it's normal?"
So pairwise-differences is used determine whether the value of a specific metric changed significantly between pairs of paired samples (e.g., pre- and post-treatment). The values in each group need to be present across all values in the chosen state column in order for this test to be executed. To use the example data from the longitudinal tutorial, both groups from the delivery column (which was the chosen group column) need to have data across all timepoints in the chosen state column (the month column in this example).
pairwise-distances also assesses changes between paired samples from two different “states”, but instead of taking a metadata column or artifact as input, it operates on a distance matrix to assess the distance between “pre” and “post” sample pairs, and tests whether these paired differences are significantly different between different groups, as specified by the group-column parameter. So for this method, all values in the distance matrix must be present within the specified groups (again, delivery if using the tutorial example) across the timepoints specified from the state column (month from the tutorial example).
Even though your commands look very similar, you are inherently looking at different data (i.e. different metrics) in the two methods you're using above. The issue you're running into is that when examining the unweighted unifrac distance matrix, within your chosen state column (Time_num), there aren't any associated samples with a value of 0 under the Lot group at Time_num 3. This is inherently different from the data associated with your shannon vector.
So essentially, in pairwise-distances you need to have values across all timepoints but in pairwise-differences you need to have values for all pairs at all timepoints. This is why (depending on your data and chosen inputs) you can sometimes 'get away' with missing data in pairwise-differences but not in pairwise-distances.