set_contents_from_string expects string, not buffer