This is probably the most common cause of early registration failures and discussed exhaustively in ITK and Elastix forums.
To give a short summary: The error occurs when random point sampling fails. It may happen if input images do not overlap enough; or if masked region is much smaller than the image. I assume your images are already pre-aligned, so most likely you have problems because of the small mask. There may be strategies to make the sampler more tolerant to small masked regions (force it to try more samples), but the most efficient solution is to crop your image so that it is not much larger than the masked area.