Improve the error message when a constrained package is not valid.

Fix #560