return error if applicable