jointcal's astrometry fitter can produce a fit that is unusably bad without doing more than printing a warning. The code in question is in the function inversePolyTransfo which is defined in Gtransfo.cc. If the chi squared is too large a warning is printed but the fit is returned, and often the fit is unusably bad. Here are two examples, from test_jointcal_decam.py. A valid fit:
And an unusably bad fit:
That function should return an empty unique_ptr if the fit fails (based on the code calling it, not the documentation). The question is: can the function always return an empty pointer if the chi squared is too large, or is it possible for the fit to be "poor, but usable", in which case the necessary code will be trickier. I hope it is the former, as that makes the code easier to understand and trivial to fix.