  We study the effect of phase slips in a quasi 1d superconducting channel
along which a current flows and report a new phenomenon where an avalanche of
phase slips occurs. This limits the critical current in thin films and wires
and drives the system to a topological phase transition at a temperature lower
than the bulk critical temperature. We describe the mechanism of such a
catastrophic phase slip avalanche and, following Kosterlitz and Thouless, we
use group renormalization techniques to derive an exact analytical expression
for the critical current as a function of film width and temperature. Our
results are in very good agreement with, and reproduce, the available
experimental data on superconducting MgB$_2$ thin films. The phenomenon we
describe is very general and can be used in the construction of new devices
where the superconducting state can coexist with the normal state.
