Volatile elements in magma, primarily water, drive explosive volcanic eruptions. The tricky part is determining just how much volatile content was present before the eruption took place. This is especially difficult when the only evidence scientists have to go on is the end product after all the volatiles have been lost.
source https://www.lifetechnology.com/blogs/life-technology-news-blog/water-drives-explosive-eruptions-magma-is-wetter-than-we-thought