Throw exception on precondition failure.
Fixes #7967.

svn path=/trunk/tools/auto_index/; revision=83952