A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
It is possible that the issue is with the range being sorted.
You may try changing the range being sorted to a larger range, such as "G4:L10", to see if the issue persists. Additionally, you can try using the SortFields object to specify the sort order instead of passing an array of objects to the apply method.
I'd suggest you create a new thread in Office development which is special channel to handle Office Script issue.
Office Development - Microsoft Q&A
Thank you for your understanding.