Flows in hoppers and silos are susceptible to clogging due to the formation of arches at the exit. The failure of these arches is the key to reinitiation of flow, yet the physical mechanism of failure is not well understood. Experiments on vibrated hoppers exhibit a broad distribution of the duration of clogs. Using numerical simulations of a hopper in two dimensions, we show that arches become trapped in locally stable shapes that are explored dynamically under vibrations. The shape dynamics, preceding failure, break ergodicity and can be modeled as a continuous-time random walk with a broad distribution of waiting, or trapping, times. We argue that arch failure occurs as a result of this random walk crossing a stability boundary, which is a first-passage process that naturally gives rise to a broad distribution of unclogging times.