Save for Web is disabled
Open both files attached in any Ai version from 26.4.1 to 27, and try to File > Export > Save for Web (Legacy) for both.
The command will be disabled for the 'bad' and enabled for 'good', although the only rectangle in both is the same.
There is something wrong in the file structure then, but what?
Also, the ExportOptionsPNG24 does nothing if a script with it gets run.
Sergey Osokin commented
Yes. It looks like Large Canvas mode breaks the exportFile() method in the scripting API. So this has been broken since CC 2020 and hasn't been noticed and fixed by Adobe.
The file that does not work is a Large Canvas Document, they don't seem to support Save for Web.