programmatically taxonomy update node DrupalDefaultEntityController error
Basically I would think that $value->tid when you are using it is not a number but an array. Because I do the same assignment and it works.

So I suspect you are misusing the taxonomy term you created. This is how I created the taxonomy in a function:

function create_new_term($term_name, $vocabulary_id, $language = LANGUAGE_NONE, $i18n_tsid = 0){
  $tid = db_insert('taxonomy_term_data')
  -&gt;fields(array(
    'name'=&gt;$term_name,
    'vid'=&gt;$vocabulary_id,
    'language'=&gt;$language,
    'i18n_tsid'=&gt;$i18n_tsid,
  ))-&gt;execute();
  db_insert('taxonomy_term_hierarchy')
    -&gt;fields(array(
      'tid'=&gt;$tid,
      'parent'=&gt;0,
  ))
  -&gt;execute();
  print "Created new taxonomy term tid #".$tid." $term_name in $vocabulary_id&lt;br&gt;"."\n";
  return $tid;
}


And here is how I add that term:

$my_new_node-&gt;field_my_term['LANGUAGE_NONE'] [] ['tid'] = $returned_tid;


I hope this helps.