{"record":{"id":"e2f4bbc67bbb45e0","repo":"Flow-Launcher/Flow.Launcher","slug":"source-directory-does-not-exist-or-could-not-be-fo","errorCode":null,"errorMessage":"Source directory does not exist or could not be found: {sourcePath}","messagePattern":"Source directory does not exist or could not be found: (.+?)","errorType":"exception","errorClass":"DirectoryNotFoundException","httpStatus":null,"severity":"error","filePath":"Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs","lineNumber":34,"sourceCode":"    public static class FilesFolders\n    {\n        private const string FileExplorerProgramName = \"explorer\";\n\n        /// <summary>\n        /// Copies the folder and all of its files and folders \n        /// including subfolders to the target location\n        /// </summary>\n        /// <param name=\"sourcePath\"></param>\n        /// <param name=\"targetPath\"></param>\n        /// <param name=\"messageBoxExShow\"></param>\n        public static void CopyAll(this string sourcePath, string targetPath, Func<string, MessageBoxResult> messageBoxExShow = null)\n        {\n            // Get the subdirectories for the specified directory.\n            DirectoryInfo dir = new DirectoryInfo(sourcePath);\n\n            if (!dir.Exists)\n            {\n                throw new DirectoryNotFoundException(\n                    \"Source directory does not exist or could not be found: \"\n                    + sourcePath);\n            }\n\n            try\n            {\n                DirectoryInfo[] dirs = dir.GetDirectories();\n                // If the destination directory doesn't exist, create it.\n                if (!Directory.Exists(targetPath))\n                {\n                    Directory.CreateDirectory(targetPath);\n                }\n\n                // Get the files in the directory and copy them to the new location.\n                FileInfo[] files = dir.GetFiles();\n                foreach (FileInfo file in files)\n                {\n                    string temppath = Path.Combine(targetPath, file.Name);","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/Flow-Launcher/Flow.Launcher/blob/7fc63b07bbaa10a0f0b2601487913fcba9ed24b0/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs#L16-L52","documentation":"Thrown as DirectoryNotFoundException from the CopyAll extension method when DirectoryInfo(sourcePath).Exists is false. The check runs before any copy attempt, so no partial state is created. It is the entry-point guard ensuring the source tree exists before recursively copying files and subdirectories to targetPath.","triggerScenarios":"CopyAll invoked with a sourcePath that doesn't exist on disk; a relative sourcePath resolved against an unexpected current directory; the source was deleted between the caller's existence check and the call; the source is on a removable/network drive that was disconnected; a typo in the configured source path.","commonSituations":"Plugin/command copies from a configured template directory that the user moved or never created; portable-mode path misconfiguration; backup/sync tools that deleted the source; network share dropped between listing and copy; a path with a typo or wrong variable interpolation.","solutions":["Verify Directory.Exists(sourcePath) before calling CopyAll and surface a clear message to the user if not.","Check the configured source directory value for typos, missing variables, or wrong casing.","For network/removable sources, confirm the drive is connected and share is reachable.","If the source should exist, recreate it from a known-good copy or installer."],"exampleFix":"// before\nDirectoryInfo dir = new DirectoryInfo(sourcePath);\nif (!dir.Exists)\n    throw new DirectoryNotFoundException(\"Source directory does not exist or could not be found: \" + sourcePath);\n\n// caller guard before invoking\nif (!Directory.Exists(sourcePath))\n{\n    messageBoxExShow?.Invoke($\"Source not found: {sourcePath}\");\n    return;\n}","handlingStrategy":"validation","validationCode":"if (!Directory.Exists(sourcePath))\n{ messageBoxExShow?.Invoke($\"Source directory not found: {sourcePath}\"); return; }","typeGuard":"null","tryCatchPattern":"try { sourcePath.CopyAll(targetPath, messageBoxExShow); }\ncatch (DirectoryNotFoundException ex) { messageBoxExShow?.Invoke(ex.Message); }","preventionTips":["Pre-check Directory.Exists(sourcePath) before calling CopyAll.","Validate configured source paths for typos and variable interpolation.","For network/removable sources, confirm connectivity before copying.","Recreate missing template directories from a known-good source."],"tags":["filesystem","copy","shared-command","validation"],"backgroundTag":null,"analyzedSha":"7fc63b07bbaa10a0f0b2601487913fcba9ed24b0","analyzedAt":"2026-08-13T14:54:20.914Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}