When saving programmatically an entity that does not have a "format" property for "body" or "description" field, the
title_field_text_with_summary_sync_set() function throws a PHP notice.
To reproduce such bug, just create a dummy term in a vocabulary that have the "description" field replaced by a standard field. The term should only have a name and the related category keys (vid and vocabulary_machine_name) and may have a description set to NULL for example.
When saving programmatically the term, the bug occurs.
You may use for dummy creation the
entity_create() function from Entity API module.