Warnings: Failed to apply metadata to file

I just did a test restore which restored all data as it was supposed to as far as I can see but I got this error message which I’m of course wondering about. What does it mean?

Warnings: [
Failed to apply metadata to file: “K:”, message: Object reference not set to an instance of an object. => Object reference not set to an instance of an object.

What I restored was a couple of folders containing flac files. I did not restore to original location but restored these few folders to the root of one hard drive.

Were you by chance test restoring to a FAT32 formatted USB drive with the drive letter K?

I believe the type of metadata involved varies depending on OS and even disk format, so if you backed up from something like an NTFS formatted drive (which supports user restrictions in metadata) but restored to something like a FAT32 formatted drive (which doesn’t do user level restrictions) you might get an error such as that…

Though I’m not sure why it’s reporting the drive letter with no file name…

Original location was on NTFS and restore was too.

It probably has something to do with the source being a couple of subfolders and the restore destination being these subfolders placed in the root of a disk. Why Duplicati would try to set rights to the root (K:) in this scenario I don’t understand though. It might be a bug.

I tried making a test job that backs up a single file from an NTFS drive then restore it onto the rood of another NTFS drive and I’m not getting any errors. Maybe it has to do with the specific metadata involved in your setup.

If you have time and feel like helping out, can you make a test job that just backs up a single file from your current job then try restoring it to K:?

(Oh, and I’m assuming this is all on the same machine at your end - not between machines.)

I tried backing up a single file and then restore the file to the root, no error. Then tried with a whole subfolder and restored the files (not the folder as I did last time) to the root of the same drive and got the same error as before. I noted I did not have “Restore read/write permissions” checked. So I tried with it checked but got the same error.

I’ll try to find some time to replicate that and see if I get the error as well. I wonder if Duplicati is treating the drive root as if it were a subfolder and attempting to apply the source folder metadata to it…

Yeah that sounds quite likely. And it hasn’t got the rights enough to change that.

I’ve been able to replicate the error and found where the “Failed to apply metatadata to file” message comes from in the code (the ApplyStoredMetadata method of RestoreHandler.cs).

I need to do some test builds to narrow down if it’s in ApplystoredMetadata or ApplyMetdata but I think I our guess (apply folder data to a drive root) is what’s going on.

2 Likes

I had the same problem (duplicate thread here: https://forum.duplicati.com/t/first-install-warning-detected-during-restore/2521).

I backed up a file that was in a nested folder and restored to the root of E. The file restored successfully, but it gave the same error as the first post. Both locations were NTFS.

I have the same problem with the current release. Is there a solution for that? Or did I miss it?

duplicati trys to set the metadata of the root directory

1939 files need to be restored (0 Bytes)
Failed to apply metadata to file: “d:\restore\freigaben_n”, message: Der Prozess kann nicht auf die Datei “\?\d:\restore\freigaben_n” zugreifen, da sie von einem anderen Prozess verwendet wird. => Der Prozess kann nicht auf die Datei “\?\d:\restore\freigaben_n” zugreifen, da sie von einem anderen Prozess verwendet wird.
0 files need to be restored (0 Bytes)
Verifying restored files …
Restore completed without errors but no files were restored
Restored 0 (0 Bytes) files to d:\restore\freigaben_n
Duration of restore: 01:59:33

duplicati.commandline restore “pathtobackup” --restore-path=d:\restore\freigaben_n\ --passphrase=“xxxx” --dbpath=“pathtobackup+sqlitefilename” --no-local-blocks --skip-restore-verification=true