Throw error when pattern is not list of terms.