Improve error messages on missing required variables.