Hi,
I'm not able to reproduce the issue that you're facing. Could you please upload a runnable test case here that we can run with npm i && npm start, so we could repro the issue and debug it?
Please try steps as: open npm run start -> access http://localhost:300 -> move Task 5 under Task 6 (don't do other action before this action). Or you can try to close current browser and try open new.
I can't reproduce the issue you mentioned. I tried many times with different tabs and browsers.
This sounds like a race condition bug. You are trying to get task DOM element, but it is not there at the moment.
I think you could better try to use https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#event-dataReady event to manipulate with DOM of edited/moved tasks, since sync doesn't guarantee DOM is ready.
When refresh project with gantt.refresh() then I'll show dialog to alert "Data is being refreshing" and block screen (not allow user to do any action).
When dataReady, I'll close this dialog and unblock screen.