When running gaincal in CASA 4.0 and higher on a dataset that was previously calibrated using an earlier version of CASA, the following error may be generated:
Caught exception: RecordInterface: field numthreads is unknown
This will cause the gaincal run to fail without producing an output file. This is due to an incompatibility between the "scratch" MODEL_DATA column used by 3.4 and the virtual model stored in the header for 4.0 and up. To fix the problem, delete any model information prior to running setjy:
Then proceed with calibration, starting at the setjy step.