Q:

What is wrong with this measurement of the synodic period of Mercury?

I'm measuring the synodic period of Mercury using Stellarium. When measuring the synodic period one needs to choose a reference point to start the measurement, and I choose the point when Mercury is on top of the Sun. This is the start date:

And this is the end date:

Inputting these two dates into a calculator gives a synodic period of 104 days. However, as one can see from Stellarium's data, Mercury's synodic period is actually 115.88 days. This measurement is off by more than 10 days.
Why is there such a large difference? It's not large in the absolute sense, but it seems well above the error margins. For example if instead I shift the start date to 9 April 2021, Mercury is discernibly not between us and the Sun.

A:

Mercury's orbit is highly eccentric: 0.21 according to Wikipedia. Therefore, the actual time between repeating occurrences will vary depending on the year. If you were to perform your calculations for many periods, the average should approach the value given by Stellarium.
The theoretical synodic period, using the sidereal period of Earth and Mercury, is 115.9 days.

A:

Addressing @Allure's comment below @ JohnHoltz's excellent answer, the synodic period is simply a function of the two periods. 
It will return something like the average value between two successive events where the planets would line up if they orbited in the same plane, but it does not predict the exact times as pointed out in that answer.
In addition to the fact that the orbits can be elliptical producing jitter, they can also have very different inclinations. In that case they will usually not line up at all, even if the orbits are circular. 
For a real-world example, try to use your same method to calculate the synodic period between Neptune and Pluto, with inclinations of about 2° and 17° and eccentricities of 0.01 and 0.25 respectively. Now imagine a body with an inclination of 90°!
Synodic period is just the period that is returned by the equation below, a function of two other periods, and you have to decide for yourself how applicable or useful the value is for your own application.
$$T_{syn} = \frac{1}{\frac{1}{T_1}-\frac{1}{T_2}} = \frac{T_1 T_2}{T_2-T_1}$$

