Raise exception when cannot find configuration.

Fixes #1645.