duplicati/duplicati · error · UserInformationException

SourceUnauthorized

SourceUnauthorized

Error message

Unauthorized to access source folder {0}, aborting backup

What it means

Thrown by Controller.ExpandInputSources when enumerating a source directory (di.EnumerateFileSystemInfos, called for the PreventEmptySource check) raises UnauthorizedAccessException. The path is wrapped as SourceUnauthorized. Note: this fires specifically during the empty-source enumeration, not the initial existence check.

Source

Thrown at Duplicati/Library/Main/Controller.cs:1255

                    }

                    var fi = new FileInfo(source);
                    var di = new DirectoryInfo(source);
                    if (fi.Exists || di.Exists)
                    {
                        foundAnyPaths = true;

                        if (!fi.Exists)
                        {
                            // If the directory exists, but is empty, and we are not allowed to have empty sources, throw an error
                            try
                            {
                                if (options.PreventEmptySource && di.Exists && !di.EnumerateFileSystemInfos().Any())
                                    throw new UserInformationException(Strings.Controller.SourceFolderEmptyError(inputsource), "SourceFolderEmpty");
                            }
                            catch (UnauthorizedAccessException ex)
                            {
                                throw new UserInformationException(Strings.Controller.SourceUnauthorizedError(inputsource), "SourceUnauthorized", ex);
                            }

                            source = Util.AppendDirSeparator(source);
                        }

                        sources.Add(source);
                    }
                    else
                    {
                        try
                        {
                            // Try to get attributes. Returns -1 if source doesn't exist, otherwise throws an exception.
                            // In this case, it is irrelevant to use fileinfo or directoryinfo to retrieve attributes.
                            var unused = fi.Attributes;
                        }
                        catch (UnauthorizedAccessException ex)
                        {
                            Logging.Log.WriteWarningMessage(LOGTAG, "AddingSourceFolder",

View on GitHub (pinned to 3f348be3e3)

Solutions

  1. Grant the Duplicati run-as account read+list (read/traverse) permission on the source folder.
  2. Run the backup under an account that has access (e.g. an admin/system context).
  3. Adjust folder ACLs/ownership so enumeration succeeds.

Example fix

// before: service account lacks access
// run as limited user -> UnauthorizedAccessException on enumerate

// after: grant permissions
// icacls "C:\data" /grant "duplicati-svc:(RD)" /T
// or run Duplicati under an account with read access
Defensive patterns

Strategy: validation

Validate before calling

if (System.IO.Directory.Exists(src))
    try { System.IO.Directory.EnumerateFileSystemEntries(src).FirstOrDefault(); }
    catch (UnauthorizedAccessException) { throw new UnauthorizedAccessException($"No read access on '{src}'"); }

Try / catch

try { controller.BackupAsync(...); }
catch (UserInformationException ex) when (ex.HelpID == "SourceUnauthorized")
{ /* grant read/list ACLs to the run-as account and retry */ }

Prevention

When it happens

Trigger: A source directory exists, is not a file, but EnumerateFileSystemInfos throws UnauthorizedAccessException while checking whether it is empty, under --prevent-empty-source.

Common situations: Running Duplicati as a user/service account without read/list permission on the source folder; folder owned by another user with restrictive ACLs; Windows folder inaccessible due to ACL inheritance changes.

Understand the failure class

Related errors


AI-assisted analysis of duplicati/duplicati@3f348be3e3 (2026-08-13). Data as JSON: /api/errors/fef33cd91f40ed5b. Report an issue: GitHub.