Quarks only exist inside hadrons because they are confined by the strong (or color charge) force fields. Therefore, we cannot measure their mass by isolating them. Furthermore, the mass of hadrons gets contributions from quark kinetic energy and from potential energy due to strong interactions. For hadrons made of the light quark types, the quark mass is a small contribution to the total hadron mass. For example, compare the mass of a proton (0.938 GeV/c2) to the sum of the masses of two up quarks and one down quark (total of 0.02 GeV/c2).
So the question is, what do we mean by the mass of a quark and how do we measure it. The quantity we call quark mass is actually related to the m in F = ma (force = mass x acceleration). This equation tells us how an object will behave when a force is applied. The equations of particle physics include, for example, calculations of what happens to a quark when struck by a high-energy photon. The parameter we call quark mass controls its acceleration when a force is applied. It is fixed to give the best match between theory and experiment both for the ratio of masses of various hadrons and for the behavior of quarks in high-energy experiments. However, neither of these methods can precisely determine quark masses.