I ran into this error when trying to load a large image (many tens of megapixels). Resizing the image (in this case to 1080P) resolved the issue.
The OP's issue didn't have to do with large size, but I wanted to share my experience because the error didn't offer lots of detail.