An enormous planet orbiting a tiny star 31 light-years from Earth has confused astronomers — because it’s not supposed to exist.

The gassy world is half the size of Jupiter yet swings around a star that’s eight times smaller than our sun.

Planets of this size are extremely rare, especially around small stars.

The newly found world, dubbed GJ 3512b, is so big that it can’t have formed in the way we think most planets do, leaving the team of Swiss, Spanish and German scientists who found it scratching their heads.

The discovery may force astronomers to rethink how planets are born, researchers said.

“Around such stars there should only be planets the size of the Earth or somewhat more massive Super-Earths,” said Professor Christoph Mordasini, a scientist at the University of Bern.

“GJ 3512b, however, is a giant planet with a mass about half as big as Jupiter’s. It’s at least one order of magnitude more massive than the planets predicted by theoretical models for such small stars.”

Space scientists found the mysterious world using a telescope at the Calar Alto Observatory in southern Spain.

GJ 3512b is a huge clump of gas and dust that orbits its star once every 204 days.

It sits 31 light-years from Earth, meaning it’s relatively nearby in space terms.

All in all, it’s pretty unremarkable until you compare it to its host, a small, dim type of star known as a red dwarf.

GJ 3512b is at least 46 percent as massive as Jupiter, yet orbits a star 12 percent the mass of the sun.

For comparison, while our sun is about 1.050 times the mass of Jupiter, GJ 3512 is only about 250 times the mass of GJ 3512b.

Planets normally form when dust and rocks bind together due to the gravitational pull of a star.

The wad gets bigger and bigger until it’s large enough to hold on to its own gas atmosphere.

But simulations carried out by the team suggest GJ 3512b could not have formed in this way.

Its star is simply too small to have the gravitational pull needed for GJ 3512b to form.

Instead, the planet was likely born after a disc of dust and rock orbiting the dwarf star collapsed under its own gravity, scientists said.

This unusual form of planet formation, called gravitational instability, was thought to be rare, but the find suggests it’s more common than we realized.

“This is the first time that we have a clear detection of a planet where the only possible way to explain it is gravitational instability,” Juan Carlos Morales, an astronomer at the Autonomous University of Barcelona who was also involved in the discovery, told New Scientist.

The research was published in the journal Science.