An uninformative error message indeed. Apparenlty, replace_with() takes variable length argument (*args), rather than a list of elements, so when given a list it attempts to insert that as if it were an element. Passing the list unpacked:
replace_with(*data)
is the way to go.