Error saving project; .mlt with 0 bytes

Just upgraded to 19.06.15 and now when I work in a project created with a previous version and try to save changes, I get an error message.

temp

Application log:

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/shotcut-MQ6720.mlt"
[Error ] <Mlt::Controller::saveXML> backup file already exists "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/1 - backup - EH6720.mlt"

After that, project file is with 0 bytes. If I use “save as…” and choose another file name, it works fine, so every time I want to save I am creating a new file by now.

Is this problem specific to using Dropbox?
Before overwriting the existing file, Shotcut now tries to rename the existing file to have a backup in case there is a problem writing the new file. After a successful save, it tries to remove the backup file. There was a problem during one of your saves leaving the backup. If the backup already exists, saving will fail as you report here. You must remove the backup file to save it under the target name.

Yes, tried in a folder out of dropbox and it works fine. But if I save it in any dropbox folder, at the second save it happens again.

If I look for that backup file it is not there. Dropbox also didn’t sync it (can’t find it via web site).

It seems that the file IS there, because of the error, but if I look for it, it is not there. Very strange.

Any test I could do to track this?

(I am not doing anything I wasn’t doing before upgrading)

There is a lot of warnings at the log file, don’t now if it is expected:

Log Text

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "C:/Users/User/Desktop/temp/shotcut-VQ3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename to backup "C:/Users/User/Desktop/temp/test.mlt" "C:/Users/User/Desktop/temp/test - backup - Ak3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename "C:/Users/User/Desktop/temp/shotcut-VQ3516.mlt" "C:/Users/User/Desktop/temp/test.mlt"

[Info ] <MainWindow::showStatusMessage> "Saved C:/Users/User/Desktop/temp/test.mlt"

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-tN3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename to backup "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test - backup - cU3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-tN3516.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Info ] <MainWindow::showStatusMessage> "Saved D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-OJ3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename to backup "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test - backup - we3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-OJ3516.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Info ] <MainWindow::showStatusMessage> "Saved D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Debug ] <TimelineDock::setSelection> Changing selection to (28) trackIndex -1 isMultitrack false

[Warning] <> file:///C:/Program Files/Shotcut/lib/qml/QtQuick/Controls/ScrollView.qml:359:13: QML Item: Possible anchor loop detected on fill.

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/timeline/Track.qml:87:25: Unable to assign [undefined] to QString

[Debug ] <Timeline::MoveClipCommand::redo> fromTrack 1 toTrack 2

[Debug ] <TimelineDock::setSelection> Changing selection to () trackIndex -1 isMultitrack false

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/filters/dynamictext/ui.qml:484: TypeError: Cannot call method ‘keyframeCount’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/modules/Shotcut/Controls/Preset.qml:40: TypeError: Cannot read property ‘presets’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Error ] <MLT> [producer_xml] failed to load producer "blank"

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-Ma3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename to backup "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test - backup - vL3516.mlt"

[Debug ] <Mlt::Controller::saveXML> rename "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-Ma3516.mlt" "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Info ] <MainWindow::showStatusMessage> "Saved D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test.mlt"

[Debug ] <TimelineDock::setSelection> Changing selection to (102) trackIndex -1 isMultitrack false

[Warning] <> file:///C:/Program Files/Shotcut/lib/qml/QtQuick/Controls/ScrollView.qml:359:13: QML Item: Possible anchor loop detected on fill.

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/timeline/Track.qml:87:25: Unable to assign [undefined] to QString

[Debug ] <Timeline::MoveClipCommand::redo> fromTrack 2 toTrack 1

[Debug ] <TimelineDock::setSelection> Changing selection to () trackIndex -1 isMultitrack false

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/filters/dynamictext/ui.qml:484: TypeError: Cannot call method ‘keyframeCount’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/modules/Shotcut/Controls/Preset.qml:40: TypeError: Cannot read property ‘presets’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:110: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:114: TypeError: Cannot read property ‘in’ of null

[Warning] <> file:///C:/Program Files/Shotcut/share/shotcut/qml/views/keyframes/Parameter.qml:115: TypeError: Cannot read property ‘in’ of null

[Error ] <MLT> [producer_xml] failed to load producer "blank"

[Debug ] <Mlt::Controller::saveXML> writing temporary XML file "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/shotcut-wP3516.mlt"

[Error ] <Mlt::Controller::saveXML> backup file already exists "D:/Dropbox/Fotos/vadebike.org/videos/2019/2019-06 Como defender as ciclovias em Audiencias Publicas/temp/test - backup - YP3516.mlt"

I will have to setup Dropbox, test it on there, and debug it or make a workaround.

Thank you very much.

(Maybe inserting a random text in backup file name so it doesn’t repeat?)

There is random text in the backup file name, but that is not the problem. The bug is something related to create a file, delete it, and then trying to create one with the same name.
I was not able to reproduce this on Dropbox, but I see the unreliable operation in my code in this and made it safer for the next version 19.07. I will give you a nightly build tomorrow to test it.

While testing the change, I finally reproduced the problem with Dropbox on a larger project file. In recent versions, Shotcut writes to a temporary file and verifies the XML before overwriting an existing project with possibly invalid data. Then, if verification is successful, it renames the temp file to the destination. Something like Dropbox may place a lock on the temp file while uploading it, which makes rename fail. I added a few retries here before giving up, and that is working for me. I suppose I could write the temporary file to the special OS-provided temporary file folder, but the risk is that if there is a problem during rename, then it is not obvious for a user where to get the temporary file. Not to mention the temp file could get cleaned up by OS task or reboot. Writing a temp file for something as critical as a project file into the destination folder makes it easier for a user to find and more durable.

You can download nightly build 19.06.30 with this fix to confirm.