{"record":{"id":"fef33cd91f40ed5b","repo":"duplicati/duplicati","slug":"sourceunauthorized","errorCode":"SourceUnauthorized","errorMessage":"Unauthorized to access source folder {0}, aborting backup","messagePattern":"Unauthorized to access source folder (.+?), aborting backup","errorType":"exception","errorClass":"UserInformationException","httpStatus":null,"severity":"error","filePath":"Duplicati/Library/Main/Controller.cs","lineNumber":1255,"sourceCode":"                    }\n\n                    var fi = new FileInfo(source);\n                    var di = new DirectoryInfo(source);\n                    if (fi.Exists || di.Exists)\n                    {\n                        foundAnyPaths = true;\n\n                        if (!fi.Exists)\n                        {\n                            // If the directory exists, but is empty, and we are not allowed to have empty sources, throw an error\n                            try\n                            {\n                                if (options.PreventEmptySource && di.Exists && !di.EnumerateFileSystemInfos().Any())\n                                    throw new UserInformationException(Strings.Controller.SourceFolderEmptyError(inputsource), \"SourceFolderEmpty\");\n                            }\n                            catch (UnauthorizedAccessException ex)\n                            {\n                                throw new UserInformationException(Strings.Controller.SourceUnauthorizedError(inputsource), \"SourceUnauthorized\", ex);\n                            }\n\n                            source = Util.AppendDirSeparator(source);\n                        }\n\n                        sources.Add(source);\n                    }\n                    else\n                    {\n                        try\n                        {\n                            // Try to get attributes. Returns -1 if source doesn't exist, otherwise throws an exception.\n                            // In this case, it is irrelevant to use fileinfo or directoryinfo to retrieve attributes.\n                            var unused = fi.Attributes;\n                        }\n                        catch (UnauthorizedAccessException ex)\n                        {\n                            Logging.Log.WriteWarningMessage(LOGTAG, \"AddingSourceFolder\",","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/duplicati/duplicati/blob/3f348be3e33f5d72d414e3ad55839c2ba34dda67/Duplicati/Library/Main/Controller.cs#L1237-L1273","documentation":"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.","triggerScenarios":"A source directory exists, is not a file, but EnumerateFileSystemInfos throws UnauthorizedAccessException while checking whether it is empty, under --prevent-empty-source.","commonSituations":"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.","solutions":["Grant the Duplicati run-as account read+list (read/traverse) permission on the source folder.","Run the backup under an account that has access (e.g. an admin/system context).","Adjust folder ACLs/ownership so enumeration succeeds."],"exampleFix":"// before: service account lacks access\n// run as limited user -> UnauthorizedAccessException on enumerate\n\n// after: grant permissions\n// icacls \"C:\\data\" /grant \"duplicati-svc:(RD)\" /T\n// or run Duplicati under an account with read access","handlingStrategy":"validation","validationCode":"if (System.IO.Directory.Exists(src))\n    try { System.IO.Directory.EnumerateFileSystemEntries(src).FirstOrDefault(); }\n    catch (UnauthorizedAccessException) { throw new UnauthorizedAccessException($\"No read access on '{src}'\"); }","typeGuard":null,"tryCatchPattern":"try { controller.BackupAsync(...); }\ncatch (UserInformationException ex) when (ex.HelpID == \"SourceUnauthorized\")\n{ /* grant read/list ACLs to the run-as account and retry */ }","preventionTips":["Run Duplicati under an account with read+traverse on all sources.","Pre-grant ACLs in provisioning scripts; fail fast on access tests."],"tags":["backup","permissions","filesystem","windows"],"backgroundTag":null,"analyzedSha":"3f348be3e33f5d72d414e3ad55839c2ba34dda67","analyzedAt":"2026-08-13T16:48:27.008Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}