{"record":{"id":"a6d8b66ebe2e7e15","repo":"JosefNemec/Playnite","slug":"can-t-scan-emulation-directory-directory-doesn","errorCode":null,"errorMessage":"Can't scan emulation directory, {directory} doesn't exist.","messagePattern":"Can't scan emulation directory, (.+?) doesn't exist\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Emulators/Scanner.cs","lineNumber":665,"sourceCode":"                mergeRelatedFiles,\r\n                fileScanCallback);\r\n        }\r\n\r\n        private List<ScannedGame> ScanDirectory(\r\n            string directory,\r\n            List<string> supportedExtensions,\r\n            List<string> scanPlatforms,\r\n            CancellationToken cancelToken,\r\n            string crcExludePatterns,\r\n            bool scanSubfolders,\r\n            bool scanArchives,\r\n            bool mergeRelatedFiles,\r\n            Action<string> fileScanCallback = null)\r\n        {\r\n            logger.Info($\"Scanning emulated directory {directory}.\");\r\n            if (!FileSystem.DirectoryExists(directory))\r\n            {\r\n                throw new Exception($\"Can't scan emulation directory, {directory} doesn't exist.\");\r\n            }\r\n\r\n            var emuDbs = emuDbProvider(scanPlatforms);\r\n            var resultGames = new List<ScannedGame>();\r\n\r\n            try\r\n            {\r\n                ScanDirectoryBase(\r\n                    directory,\r\n                    supportedExtensions,\r\n                    emuDbs,\r\n                    resultGames,\r\n                    cancelToken,\r\n                    crcExludePatterns,\r\n                    scanSubfolders,\r\n                    scanArchives,\r\n                    mergeRelatedFiles,\r\n                    fileScanCallback);\r","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Emulators/Scanner.cs#L647-L683","documentation":"Thrown by ScanDirectory (the low-level overload taking supportedExtensions/scanPlatforms) when FileSystem.DirectoryExists(directory) is false. The scan requires a real, accessible directory on disk; a missing or inaccessible path is a fatal precondition failure.","triggerScenarios":"Calling ScanDirectory with a directory path that does not exist on disk — an unmounted drive, a moved/deleted ROM folder, a network path that is offline, or a typo in the scan configuration.","commonSituations":"External ROM drive disconnected; network share unavailable; user moved their ROM library but did not update the scan directory; portable drive letter changed.","solutions":["Verify the directory exists and is accessible (Directory.Exists) before initiating the scan.","Update the scan configuration to point at the current ROM location.","For removable/network paths, confirm the drive is mounted or the share is reachable before scanning."],"exampleFix":"// before\nif (!FileSystem.DirectoryExists(directory)) { throw new Exception($\"Can't scan emulation directory, {directory} doesn't exist.\"); }\n\n// after — caller-side guard\nif (!Directory.Exists(scanDir)) {\n    logger.Warn($\"Scan directory not found: {scanDir}. Skipping.\");\n    continue;\n}","handlingStrategy":"validation","validationCode":"// Confirm the directory exists before invoking ScanDirectory.\nif (!Directory.Exists(directory)) {\n    logger.Warn($\"Scan directory missing: {directory}\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try { ScanDirectory(...); }\ncatch (Exception ex) when (ex.Message.Contains(\"doesn't exist\")) {\n    logger.Warn($\"Scan directory unavailable: {directory}\");\n}","preventionTips":["Validate scan directories at config-save time.","For removable/network paths, check existence right before scanning.","Allow users to re-locate missing ROM directories from the scan UI."],"tags":["emulator","scanner","filesystem","precondition"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}