I constrain a possible supernova origin for gamma-ray bursts (GRBs) by modelling the dynamical interaction between a relativistic jet and a stellar envelope surrounding it. The delay in observer time introduced by the jet traversing the envelope should not be long compared with the duration of gamma-ray emission; also, the jet should not be swallowed by the spherical explosion it powers. The only stellar progenitors that comfortably satisfy these constraints, if one assumes that jets move ballistically within their host stars, are compact carbon–oxygen or helium post-Wolf–Rayet stars (type Ic or Ib supernovae); type II supernovae are ruled out. Notably, very massive stars do not appear to be capable of producing the observed bursts at any redshift unless the stellar envelope is stripped prior to collapse. The presence of a dense stellar wind places an upper limit on the Lorentz factor of the jet in the internal shock model; however, this constraint may be evaded if the wind is swept forward by a photon precursor. Shock breakout and cocoon blowout are considered individually; neither presents a likely source of precursors for cosmological GRBs.
These envelope constraints could conceivably be circumvented if jets are laterally pressure-confined while traversing the outer stellar envelope. If so, jets responsible for observed GRBs must have been launched from a region several hundred kilometres wide, have been crossed by strong shocks, or have mixed with envelope material as they travel. A phase of pressure confinement and mixing would imprint correlations among jets that may explain observed GRB variability–luminosity and lag–luminosity correlations.