Throw exception on precondition failure.
Fixes #7967.

[SVN r83952]
Create merge base for git.