Astronomers have discovered thousands of planets outside the Solar System1, most of which orbit stars that will eventually evolve into red giants and then into white dwarfs. During the red giant phase, any close-orbiting planets will be engulfed by the star2, but more distant planets can survive this phase and remain in orbit around the white dwarf3,4. Some white dwarfs show evidence for rocky material floating in their atmospheres5, in warm debris disks6–9 or orbiting very closely10–12, which has been interpreted as the debris of rocky planets that were scattered inwards and tidally disrupted13. Recently, the discovery of a gaseous debris disk with a composition similar to that of ice giant planets14 demonstrated that massive planets might...