  For binary systems with an unseen primary and a luminous secondary, the
astrometric wobble of the secondary could be used to study the primary. With
Gaia, it is possible to measure the mass of the black hole or neutron star with
a luminous companion (hereafter BH/NS-LC). Our aim is to provide a method for
predicting Gaia's ability in measuring the mass of BH/NS-LCs. We also tried to
estimate the number of solvable BH/NS-LCs using Gaia. We used a realistic
Markov chain Monte Carlo simulation of mock Gaia observations to obtain a
relation between the uncertainty of mass measurement of the primary in
BH/NS-LCs with the observable variables of the secondary astrometric orbit.
Furthermore, we used the MOBSE code to evolve a Galactic BH/NS-LC sample with a
combined Milky Way model. Our relation is applied to this sample to estimate
the number of solvable BH/NS-LCs. We derived a good relation between the mass
uncertainty and the binary parameters. For the first time, we show the
quantitive influence of the period P, inclination i, eccentricity e, and
ecliptic latitude $\beta$ to the mass measurement. Our results suggest that
$48^{+7}_{-7}$ BH-LCs and $102^{+11}_{10}$ NS-LCs are solvable during a 5 yr
Gaia mission. We also give the distribution of the distance and apparent
magnitude of the Gaia solvable BH/NS-LCs. This solvable sample would be
increased by additional spectroscopic data or a prolonged Gaia mission. The
mass uncertainty relation could be used in future simulations of BH/NS-LCs
observed by Gaia. The prediction of the solvable BH/NS-LCs is not only
influenced by the process in generating the Galactic BH/NS-LC sample, but is
also affected by our uncertainty relation. In particular, the relations of
parameters such as $[P, e, i, \beta]$ are very useful to correct the selection
effect in the statistic results of the future BH/NS-LC sample observed by Gaia.
