The problem is that the number of peak height values was not the same for all spins!
The error message was being caused by the math_fns.relax_fit C object 'setup' function being feed in
incorrect values, causing relax to fail directly after the setup() call in
specific_fns.relax_fit.minimise(). The number of points was being taken from cdp.relax_times, but
in the Relax_fit.test_bug_19887_curvefit_fail system test, one of the 3 spins has 4 points rather
than 5. Now the correct number is sent into setup().