How do you clear a field value with entity_metadata_wrapper()? Suppose I have an entity with a field field_foo on it and I want to clear that field's value.

What should I pass to $wrapper-&gt;set()?

I have tried NULL and array() and both produce an error message.
The problem is that you must set an empty value that is compatible with the data type of your field. If you do not, you will get an exception raised. Passing NULL or array() when a string is expected will therefore raise an error. 

Another thing to keep in mind is that the data you pass will also depend on whether your field is a single value, a multi-value field, or a field with multiple properties.

If your field is a single value (and thus the wrapper for the field is an instance of EntityValueWrapper) then you should assign it an empty value compatible with the data type in question. For instance the two following methods are equivalent:

$wrapper-&gt;title = '';
$wrapper-&gt;title-&gt;set('');


However the following three examples will raise an exception, because the data types are not compatible with the title field:

$wrapper-&gt;title-&gt;set();
$wrapper-&gt;title-&gt;set(NULL);
$wrapper-&gt;title-&gt;set(array());


If your field is a field with multiple properties (for instance a formatted text field, which defined both a value and format property) and thus an instance of EntityStructureWrapper, then array() or NULL will be the correct empty value. So you can do the following:

$wrapper-&gt;field_formatted_text = array();
$wrapper-&gt;field_formatted_text = NULL;


But in that case, passing an empty string would have raised an error. Note that you could have chosen to make the value property empty instead, in which case a string is the correct data type:

$wrapper-&gt;field_formatted_text-&gt;value = '';


Finally, if your field is a multi-value field (and thus your wrapper is an instance of EntityListWrapper) then array or NULL are the correct empty values, and the following three lines are equivalent:

$wrapper-&gt;field_example_multiple-&gt;set();
$wrapper-&gt;field_example_multiple = array();
$wrapper-&gt;field_example_multiple = NULL;


Note:
Calling the clear method on the wrappers is not equivalent to setting the field to an empty value. When the field is set to an empty value, it then calls EntityMetadataWrapper::updateParent on the field's parent wrapper. This ensures amongst other things that the setter callback defined by hook_entity_property_info is called. Calling clear does not do that.