Error messages: delayed rendering with templating

same idea here about renaming `$key` to `$field`