The issue is how the Qualtrics runtime is calling / interacting with our custom code. Documentation (https://www.qualtrics.com/support/survey-platform/survey-module/question-options/add-javascript/) states that "addOnload() – Executed when the page is loaded." and in my understanding this should execute only once for a javascript question loaded (and this is what happens mostly.
However, we are seeing a bug, by qualtrics - that addOnload() function is being called in the middle of the question and we lose all our variables. More interestingly, we are observing the issue on Windows browsers - Firefox and Chrome and we did not experience this issue on MacOS.
We have an old version of survey which uses less memory and it works fine; we are seeing the issue with the newer version after our memory usage has increased. This may be one of the causes, but I am not sure.
The issue looks similar to an old issue once discussed on stackoverflow: https://stackoverflow.com/questions/29159984/qualtrics-surveyengine-addonload-runs-twice-in-preview-mode-in-qualtrics-survey But I guess now the runtime mechanisms are different and the solution also does not apply.
Question
Intermittent bug - Qualtrics.SurveyEngine.addOnload being called twice on the survey page for a Java
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

So I guess there is a limit in their system, which restricts field values to be less than 20,000 characters. We were saving some data store dump and hit this limit. We never saw this error before, but started seeing it recently.