Improve an error message.

Fixes #1612.