Why does my omnibus test do not agree with post hoc test? So I am running a simple Dunn's Test on my data. After running the Kruskal-Wallis H Test, it returned a result

data:  Mean_Lesion_Height by ISOLATE
Kruskal-Wallis chi-squared = 56.324, df = 40, p-value = 0.04499

Clearly, the p value is <0.05 suggesting that there is difference in the median of the groups I tested.
To identify which of these groups showed the significant difference. I run a post hoc test of Dunn's Test using dunnTest() and gave me the result
 Kruskal-Wallis rank sum test 
  
 data: x and g 
 Kruskal-Wallis chi-squared = 56.3235, df = 40, p-value = 0.05 

Suddenly, p-value changed and dunnTest() can no longer identify which groups are different.
to perform the Dunn's Test, I set the method to "bonferroni", I also tried "none", "sidak", "holm", "hs", hochberg", "bh", "by", and still get a p-value of 0.05 in dunnTest().
Can somebody please explain to me why this is happening? Also, how do I choose the correct p adjustment method?

I only see one contrast group in the post-hoc test. Make sure that your IV is coded as a factor.
It can happen that the global test is significant while none of the post-hoc comparisons is due to p-value adjustment.
Also strictly speaking the Kruskal-Wallis test just suggests that the distributions differ. We can only assume that medians differ based on that.
