Filepath longer than 256 bytes cause FileAccessError under Windows 7

currently running Duplicati - 2.0.4.34_canary_2019-11-05

Filepath longer than 256 bytes cause FileAccessError under Windows 7:
[Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file

There are some Windows apps, which can read long filepaths, like Total Commander and Windows Explorer, some does not, like Faststone Viewer v6.5 or Duplicati.

I would welcome to have Duplicati in first group :wink:

I tested this and can’t reproduce the problem. I made 5 nested folders of 63 characters each and placed a file inside each one. Duplicati had no issue backing them all up from what I can see.

Here is a screen shot of the restore dialog:

This was on a test Win7 VM with a fresh install of Duplicati. Set up a blank backup job with all options at default settings.

Hmm.
Then how could I debug why those files are not accessible for Duplicati?

Can you post what options you are using at the main Duplicati settings level, and also what you’re using at the backup job level? (Sanitize any passwords or other sensitive info…)

I saw an older thread about how using --usn-policy may trigger this but it was older and I think it has been fixed.

A better log than the one-line default (which unfortunately drops most important details) might help.

Live log at About --> Show log --> Live --> Warning is one, or for long-term you could set a –log-file.

Reporting options also seem pretty good at emailing some of the detailed messages when jobs fail.

A completely different approach would be to see how Windows running as your Duplicati user does. Sometimes files have permission issues, or are locked. (–snapshot-policy can help get locked files).

v2.0.3.12-2.0.3.12_canary_2018-10-23

Fixed issues with long paths and USN, thanks @dgehri

v2.0.4.3-2.0.4.3_canary_2018-11-13

Rewrote path handling across the project to better support long paths, thanks @verhoek

Issue 3311 PathTooLongException when using USNJournal #3456 looks like it went in Nov 8, 2018.
Although not relevant to current topic, latest beta came from v2.0.3.14-2.0.3.14_canary_2018-11-08 meaning possibly it could show some long path problems. For current topic, I’d suggest a log check.

Can’t find it here on 2.0.4.34_canary_2019-11-05 over all four combinations of VSS and USN on/off however I’m seeing a worrisome non-detect of added files with USN on and VSS off. It needs a look.

1 Like

FYI, our Windows build system (AppVeyor) has encountered the maximum path length issue. We are currently ignoring certain tests because of it.

1 Like

I got errors like this in the error log:

   a következő helyen: System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   a következő helyen: System.IO.FileSystemEnumerableIterator`1.CommonInit()
   a következő helyen: System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   a következő helyen: System.IO.Directory.GetFiles(String path)
   a következő helyen: Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   a következő helyen: Duplicati.Library.Common.IO.SystemIOWindows.GetFiles(String path)
   a következő helyen: Duplicati.Library.Snapshots.NoSnapshotWindows.ListFiles(String localFolderPath)
   a következő helyen: Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-10 01:25:58 +01 -

It also reports
System.IO.DirectoryNotFoundException.

So it seems to be a long file path problem under Windows.

For Windows 10, recent versions, launching regedit and setting
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled from 0 to 1 and rebooting fixed this issue for me.

Insert the usual warning about editing the registry.

I also ran into this problem. Adding a key to the registry does not solve the problem.
To repeat the problem you need to create a path with a length of 260 characters Test.zip (6.6 KB)
For example: C:\Test\3evbzBvpq9AyRmPoiW2XTfVhWmxKSNsnXsZLrWrudcE0aISYKvW6f4mGuzeXlg2\OJawMIOyrJQrXS9HkMPpUbJRwx1jtdyCVtvYGU739Hc63koV7L0U77LM0kPa4pj\phK5YIjDOIS8CdvycXI7w6rrEqeG9RaXWYbBWMWp2SpQz4gOKAE2YKX6HrglOCq\Warnings_0_jghye64hywrtw542fd5t35wr3t3fadaer445y34\file8.txt

ServerVersionName : - 2.0.4.34_canary_2019-11-05
CLROSInfo : {“Platform”:“Win32NT”,“ServicePack”:"",“Version”:“10.0.18362.0”,“VersionString”:“Microsoft Windows NT 10.0.18362.0”}

(Sorry to post, I use translate.google.com)

Welcome to the forum @Sash

Windows 10 version history says 18362 is Version 1903 (May 2019 Update). The LongPathsEnabled registry control has been active since Version 1607 (Anniversary Update) according to resources such as How to Make Windows 10 Accept File Paths Over 260 Characters. Did you restart, or login again?

It’s somewhat irrelevant anyway because Duplicati has long meant to work around this limit without an operating system level change (which would not be possible on Windows 7 which ends support soon).

Windows 7 support will end on January 14, 2020

Maximum Path Length Limitation is probably an authoritative reference, and one fine point that many of the other articles omit is that the actual limit in terms of entered characters (typically visible) is 259, due to a trailing NUL character which ends strings internally. It also talks about the \\?\ workaround I’ll use.

is maybe off by 1 because it should use path.Length + 1 to allow for the NUL character in the count.

Here’s a test with mkdir. You can delete using File Explorer on Windows 10. If stuck, use rmdir instead.

mkdir    \\?\C:\deeptest
mkdir    \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

mkdir    \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345
mkdir    \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123456
mkdir    \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1234567
mkdir    \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345678

copy NUL \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1.txt
copy NUL \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12.txt
copy NUL \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123.txt
copy NUL \\?\C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1234.txt

Look around with File Explorer to see that all the files are there. If Command Prompt, use cd and dir:

C:\>cd \deeptest\1*

C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890>dir
 Volume in drive C is Windows
 Volume Serial Number is 5822-1128

 Directory of C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

11/30/2019  07:54 AM    <DIR>          .
11/30/2019  07:54 AM    <DIR>          ..
11/30/2019  07:54 AM                 0 1.txt
11/30/2019  07:54 AM                 0 12.txt
11/30/2019  07:54 AM                 0 123.txt
11/30/2019  07:54 AM                 0 1234.txt
11/30/2019  07:54 AM    <DIR>          12345
11/30/2019  07:54 AM    <DIR>          123456
11/30/2019  07:54 AM    <DIR>          1234567
11/30/2019  07:54 AM    <DIR>          12345678
               4 File(s)              0 bytes
               6 Dir(s)  29,901,381,632 bytes free

C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890>

Run a backup of C:\deeptest and get warnings, but note that some longer files and folders do not warn:

  "Warnings": [
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123456\\",
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123.txt",
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\",
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123456\\",
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123.txt",
    "2019-11-30 07:55:11 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\"
  ],

Take a closer look at what made it, from the Restore option in the Web UI. Notice there are some gaps:

Alternatively, you can see gaps using a find command from the web UI Commandline by changing the Command dropdown to find and the Commandline arguments to * (replacing source path in that box).

Listing contents 0 (11/30/2019 7:55:11 AM):
C:\deeptest\ 
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\ 
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1.txt (0 bytes)
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12.txt (0 bytes)
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1234.txt (0 bytes)
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345678\ 
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\1234567\ 
C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345\ 
Return code: 0

For a more detailed view of Warnings than the one-line notes in the default log provide, add a –log-file.

2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123456\
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123456\'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123.txt
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123.txt'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345\
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Common.IO.SystemIOWindows.GetFiles(String path)
   at Duplicati.Library.Snapshots.NoSnapshotWindows.ListFiles(String localFolderPath)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123456\
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123456\'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123.txt
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\123.txt'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()
2019-11-30 08:50:51 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345\
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\deeptest\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\12345'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path)
   at Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
   at Duplicati.Library.Common.IO.SystemIOWindows.GetFiles(String path)
   at Duplicati.Library.Snapshots.NoSnapshotWindows.ListFiles(String localFolderPath)
   at Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()

Is this the behavior you see on your system, where the warning is just at exactly 260 visible characters?

C:\Test\3evbzBvpq9AyRmPoiW2XTfVhWmxKSNsnXsZLrWrudcE0aISYKvW6f4mGuzeXlg2\OJawMIOyrJQrXS9HkMPpUbJRwx1jtdyCVtvYGU739Hc63koV7L0U77LM0kPa4pj\phK5YIjDOIS8CdvycXI7w6rrEqeG9RaXWYbBWMWp2SpQz4gOKAE2YKX6HrglOCq\Warnings_0_jghye64hywrtw542fd5t35wr3t3fadaer445y34\file8.txt is 260, so the off-by-one decides it will fit, but after the NUL it’s actually 261 characters and so the normal-handling code chokes.

I’m kind of curious whether Windows 7 will have the identical behavior, but I’d need @klor to try that…

EDIT: My testing above was on Windows 10 Version 1909 as visible from Settings --> System --> About

EDIT 2: The PathTooLongFuncWrapper that shows up in the warnings is where bad decision point lies:

however whoever fixes this needs to be careful of any other uses of IsPathTooLong, such as this one which I don’t understand well. If need be, another possible fix would be to expand the catch list above.

1 Like

Same problem here. I have to say that this started on two different computers, with different datasets on Octuber. I’m using canary versions and updating regularly. All the problem started on both computers (regularly patched windows 7 and Windows Server 2012R2) with this kind of error:

Failed: Unexpected difference in fileset version 1: 04/10/2019 4:00:00 (database id: 105), found 323898 entries, but expected 323900
Details: Duplicati.Library.Interface.UserInformationException: Unexpected difference in fileset version 1: 04/10/2019 4:00:00 (database id: 105), found 323898 entries, but expected 323900
en Duplicati.Library.Main.Database.LocalDatabase.VerifyConsistency(Int64 blocksize, Int64 hashsize, Boolean verifyfilelists, IDbTransaction transaction)
en Duplicati.Library.Main.Operation.Backup.BackupDatabase.<>c__DisplayClass33_0.<VerifyConsistencyAsync>b__0()
en Duplicati.Library.Main.Operation.Common.SingleRunner.<>c__DisplayClass3_0.<RunOnMain>b__0()
en Duplicati.Library.Main.Operation.Common.SingleRunner.<DoRunOnMain>d__2`1.MoveNext()

After repairing this error, it came up with the one below that is related to the file path length:

2019-12-03 03:01:59 +01 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: <<greater_than_260_chars_path;original_path_removed>>
System.IO.DirectoryNotFoundException: No se puede encontrar una parte de la ruta de acceso '<<greater_than_260_chars_path;original_path_removed>>'.
en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
en System.IO.File.GetAttributes(String path)
en Duplicati.Library.Common.IO.SystemIOWindows.PathTooLongFuncWrapper[T](Func`2 nativeIOFunc, Func`2 alternativeIOFunc, String path, Boolean prefixWithUnc)
en Duplicati.Library.Utility.Utility.<EnumerateFileSystemEntries>d__20.MoveNext()

Interesting… I was able to reproduce your test. Backup failures with the “> 260” check:

  "Warnings": [
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123456\\",
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123.txt",
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\",
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123456\\",
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\123.txt",
    "2019-12-03 05:26:40 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\"
  ],

Changed test to “> 259” and retried:

  "Warnings": [
    "2019-12-03 05:39:25 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\",
    "2019-12-03 05:39:25 -08 - [Warning-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-FileAccessError]: Error reported while accessing file: C:\\deeptest\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\12345\\"
  ],

A little better! Then I changed it to “> 258” and tried again. No errors this time. Going to delve deeper when I get a bit more time.

Thanks for looking at it. Now that I look again, it’s odd that I got warnings on two folders but only one is missing from the backup. The .txt file at least is consistent.

123.txt warning and missing
123456\ warning and missing
12345\  warning and present

For the missing ones, the trailing slash (Duplicati add?) may add a character, but what’s with 12345\?

I think I verified that VSS (–snapshot-policy=required) fixes this particular case, but I’m not certain that the additional prefixing added (e.g. \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy12617 in one forum post, with probably an unpredictable number of digits) didn’t just move the “gap” elsewhere.

I don’t understand why you get a warning for that one folder yet it shows up in the backup listing. Very odd.

I did my testing with default options, so no snapshots. I am not surprised that snapshots work around this issue, because (from what I recall) reading the snapshot requires software (Duplicati) to use the special \\?\ prefix. The 260 char limit doesn’t appply when using such prefixes according to MS documentation.

Also that documentation confirms that the trailing nul counts as one of the 260 chars. So the test in the source should almost certainly be changed to >259. Not sure why I had to use >258 - needs more investigating.

Perhaps we could hear if @klor @Sash and @davidtgbe can test Duplicati running with VSS and as administrator. This is probably easiest if their usual account is not a “Standard User”, and so exercising administrator privilege can be done without actually going to a different account (confusing Duplicati…).

I’ve tested as Admin and as a service with same result. Isn’t VSS used by default?

No, and if it were then it would error for the default .msi install because the user would not have privilege.
Windows service installs by default run as SYSTEM, so should have enough privilege without extra work.
The –snapshot-policy page gives the options. For testing, you likely want required, to be sure you get it.

After thinking about this a bit more, I think I have a (now) obvious answer. C# string type is UTF-16, so we need to account for a 16-bit null terminator (2 bytes). So the test should definitely be for >258 which in my limited tests solved the issue.

Pull request submitted

Tested settings (VSS to Auto and USN to Auto) on the Windows 7 machine and now no warnings!
Thanks!