Apparently this only happens in certain circumstances (though I don't know
what those are).

I have code in my application where the text widget is set up
before the scrollbar and I don't get this error.