Use invalid_data key for error message. Closes #2002.