merge: Check insert_head_ids error in create_virtual_base insert_head_ids can fail due to allocation error