What version of CellProfiler are you using? That seems similar to a bug that was fixed a few years ago, so I'm wondering if perhaps it's an old version and simply upgrading would fix the issue.
Otherwise, please provide us your OS, what version of CellProfiler this is happening in, under what circumstances you're getting this error (is it when you're drawing? Trying to erase? etc) and a pipeline and sample images to help us troubleshoot the issue.