I think I’ve seen those stack errors in my testing several months ago and it may have to do with the returned XML string where there’s a character it doesn’t like, like a \r or some other weird stuff that shouldn’t be in the XML and we’ve had to replace those with empty spaces before running them with nlapiStringToXML function.