Throw error if model has no keys defined. #509