Every supernova so far observed has been considered to be the terminal explosion of a star. Moreover, all supernovae with absorption lines in their spectra show those lines decreasing in velocity over time, as the ejecta expand and thin, revealing slower-moving material that was previously hidden. In addition, every supernova that exhibits the absorption lines of hydrogen has one main light-curve peak, or a plateau in luminosity, lasting approximately 100 days before declining. Here we report observations of iPTF14hls, an event that has spectra identical to a hydrogen-rich core-collapse supernova, but characteristics that differ extensively from those of known supernovae. The light curve has at least five peaks and remains bright for more than 600 days; the absorption lines show little to no decrease in velocity; and the radius of the line-forming region is more than an order of magnitude bigger than the radius of the photosphere derived from the continuum emission. These characteristics are consistent with a shell of several tens of solar masses ejected by the progenitor star at supernova-level energies a few hundred days before a terminal explosion. Another possible eruption was recorded at the same position in 1954. Multiple energetic pre-supernova eruptions are expected to occur in stars of 95 to 130 solar masses, which experience the pulsational pair instability. That model, however, does not account for the continued presence of hydrogen, or the energetics observed here. Another mechanism for the violent ejection of mass in massive stars may be required.