Turns out this is a known Stockfish bug. The curly brackets { } that are required to enclose annotation comments are removed by Stockfish when the file is saved. So, a comment like {INACCURACY (-0.28)} that was added (correctly) to the PGN file by chess.com's Game Review becomes just INACCURACY (-0.28), without the brackets, so it is no longer valid PGN. The Stockfish Github has an open issue for this bug.
https://github.com/daylen/stockfish-mac/issues/68
I should add that it's Stockfish for Mac that has the bug. I don't know if the bug exists in other implementations of Stockfish. A work-around: I've set up HIARCS Chess Explorer to use Stockfish as analysis engine. I analyze the games within HCE. That way I still get to use Stockfish for analysis, but the files aren't corrupted.
Apologies if this isn't the right forum for this question...
After I play a game on chess.com, I run the Game Review, download the resulting PGN file, open it in Stockfish, add some alternative lines, and save the file. Then when I attempt to reopen the file in Stockfish, Stockfish says the document could not be opened. The only app that has touched the file is Stockfish itself. When I look at the file in a text editor, it's formatted differently from the original file downloaded from chess.com, but it looks like reasonable PGN.
I'm using a Macbook. I thought maybe line endings were being changed, but that's not the case. Has anyone encountered this behavior? Suggestions?
Thanks in advance.