better KeyError exception message in preprocessor