Entire project reset after synchronize error?

So I was checking out Defold (on Windows) for the last couple of hours and I just randomly pressed file->synchronize and then pressed cancel.

Then I got an error (this is what I found from the logs)

clojure.lang.ExceptionInfo: handler ‘:synchronize’ in context ‘:global’ failed at ‘:run’ with message ‘Could not delete file A:\some_name\some_name\main\images\some_name’

And after that…all my work of the last 2 hours was just gone? I believe it reverted back to the initial commit. I mean, I don’t really care about 2 hours worth of experimenting but I was just wondering how something like this could happen. Was I supposed to commit my work or something? And is there any local cache?

I do remember that I was removing folders from the file explorer and that the editor was giving errors and shortly after that I tried to synchronize.

Edit: Maybe related to issue #1177?

Looks like https://github.com/defold/editor2-issues/issues/1177 . Have the same problem. But in my situation all changes was in git stash.

Nothing in my git stash

O well, guess I’ll just start over and have backups ready next time :face_with_raised_eyebrow:

Could you please report this issue in the editor2-issues repo linked to above and attach your log? Or mail me the log if thats easier? We take data loss issues seriously but they are often difficult to reproduce in our environment so we’re grateful for any leads.

2 Likes

I use external git client for syncing changes (sourcetree and github’s client) and you should probably too if project is important. Or use command line but clients are convenient to see things visually. Be very consistent with making commits.

I also use backup services to automatically make versioned backups of all project file changes at night.

2 Likes

I agree that for a power user an external tool is the way to go. But with that said, the internal Git support of the editor must function without problems such as this one.

2 Likes

I keep getting this error. It’s so sad when you have worked on something for hours and it just gets deleted. It happens on every restart. The only way I can “keep my code” is to backup the entire folder by copying it to another location.

1 Like

So every time you restart Defold and open you project? Can you work me through what you do step by step and as detailed as possible?

1 Like

I can reproduce it by either just restarting defold or by using the cmd U to sync.

It seems impossible to cancel.

Also, i don’t have anything previously stashed.

A setting “Don’t sync on restart” would be enough for me. I’ll probably be using an external git client anyways.

@mats.gisselson and @Erik_Angelin, any idea what could be wrong here?

2 Likes

At some point the editor was shut down while a Synchronize was in progress. If this happens we attempt to keep track of what’s going on so we can resume the sync. Inside your project folder is a hidden directory named “.internal” that probably contains a hidden file named “.sync-in-progress”. This contains information about what commit you were at as well as a reference to the git stash of your changed files.

The error you’re getting means that we’re unable to restore the state of the project to the pre-sync state, when your local changes were present. It is unclear why we’re not able to do so from the error, but it could be a permissions issue, or possibly we’re not handling bad git object references in the “.sync-in-progress” file gracefully.

Removing the “.sync-in-progress” file from the “.internal” folder will stop the editor from trying to resume the sync, but you might want to keep it around if you want to try to dig up your changes from the git database.

Sorry about your lost work. We will be looking into revising the sync workflow to make it more robust in the future, as it still seems to fail on corner cases from time to time.

8 Likes

Thanks guys! I keep my eyes open for updates.

I ended up initialising a new git repository with github as remote.

1 Like