node_save is not same as saving a node manually I've removed many terms from a vocabulary and now I see this error when I see a node referencing the deleted term(also the attachment):

EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7693 of D:\xampp\htdocs\gij\includes\common.inc).


I know it is an issue( like this) which goes away if I edit and save the node manually but does not work out if I run this code from Drush:

$node = node_load($nid);

 if ($node !== FALSE) {
  print "Saving the $full_path\n";
  node_save($node);
  }


Why this difference?
Try one of this options:

Explicit field deletion:

$node = node_load($nid, NULL, FALSE); // Force to load
if (!empty($node-&gt;nid)) {
  $node-&gt;field_taxonomy_term = NULL; // Reset the field
  node_save($node);
}


Submit the node form programmatically:

$node = node_load($nid, NULL, FALSE); // Force to load
if (!empty($node-&gt;nid)) {
  $form_state['node'] = $node;
  $form_state['values']['op'] = t('Save');
  drupal_form_submit($node-&gt;type . '_node_form', $form_state, $node);
}


Edit all nodes on bulk with views bulk operations: 


Install https://drupal.org/project/views_bulk_operations
Add a new view page of content (node) and set fields as display.
Add field "Bulk operations: Content"
Configure the fields: SELECTED BULK OPERATIONS: "Save content" (check)
Save the view and go to the views path.
Select all items and the "Save" operation and execute it!
Done!