Thank you for the bug report!
The attached patch fixes the issue and improves the error message tomatch other similar messages.