Tree - Error: sNode is null /tree/codebase/dhtmlxtree.js Lin

Every once in awhile I get this error. It seems random. I have the tree displayed, but when I get this error I am not really using it.

The error can appear in two cases

a) if you calling grid’s API (smartRefreshItem most probably) with incorrect (not existing) row ID values
b) if you are using smartRefreshBranch with XML, which contains empty tree@id values