Raise TypeError if the config file is malformed

Fixes #1504.
The example's description mentions `TypeError`, the body mentions `NoMethodError`.