Patch Set 1: I would prefer that you didn't submit this

Thanks a lot for your contribution. You definitely found a bug here... However, I don't think this change would fix bug 339986 (if I'm not mistaken, the stack trace deals with AdditionalRefsNode, not ErrorNode)...
Please update the commit message accordingly (see inline comments).