This paper studies the empirical and theoretical association between the duration of a pegged exchange rate and the cost experienced upon exiting the regime. We confirm empirically that exits from pegged exchange rate regimes during the past two decades have often been accompanied by crises, the cost of which increases with the duration of the peg before the crisis. We explain these observations in a framework in which the exchange rate peg is used as a commitment mechanism to achieve inflation stability, but multiple equilibria are possible. We show that there are ex ante large gains from choosing a more conservative not only in order to mitigate the inflation bias from the well-known time inconsistency problem, but also to steer the economy away from the high inflation equilibria. These gains, however, come at a cost in the form of the monetary authority's lesser responsiveness to output shocks. In these circumstances, using a pegged exchange rate as an anti-inflation commitment device can create a "trap" whereby the regime initially confers gains in anti-inflation credibility, but ultimately results in an exit occasioned by a big enough adverse real shock that creates large welfare losses to the economy. We also show that the more conservative is the regime in place and the larger is the cost of regime change, the longer will be the average spell of the fixed exchange rate regime, and the greater the output contraction at the time of a regime change.