Got perplexing `push failed` error with Realm-CLI

I’ve been using the Realm-CLI for the past several weeks to maintain a local copy of my Realm app, edit changes there, and then push changes to Realm However, all of a sudden when I tried to push my changes today, I got this error:

push failed: invalid character '\x00' looking for beginning of value

I tried undoing my changes, but I still got the same error.

I then tried pulling my Realm app to another directory and immediately pushing back to Realm from there, which did work (it didn’t push anything because there weren’t any changes, but it didn’t have the push failed error).

I then added my edited file to this new working directory. I tried pushing, and I got an error message about not formatting my Value correctly, which I quickly fixed. However, when I tried to push again, it gave the push failed error. Even when I undid the edits to the file, the push failed error remained (I would have expected it to return to the formatting error).

I was suspecting that the error was being caused by the error about badly formatting the Value file, but even after re-downloading the Realm app and formatting the file correctly before ever trying to push, I still got the push failed error. I did more experimenting, but no matter what I tried I couldn’t get the file to push.

But eventually, after trying a bunch of random things, it just worked! But I’m left perplexed because the last thing I did was something I had tried doing before, but for some reason this time it fixed the problem. So really I have no idea what fixed it, and I can’t even reproduce the bug anymore.

Do you have any insight on the cause of this error so that I can more quickly and easily resolve it in the future?