{"record":{"id":"9fb1bf217a004d76","repo":"JosefNemec/Playnite","slug":"emulator-not-found-9fb1bf","errorCode":null,"errorMessage":"Emulator not found.","messagePattern":"Emulator not found\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Emulators/Scanner.cs","lineNumber":198,"sourceCode":"            {\r\n                this.emuDbProvider = emuDbProvider;\r\n            }\r\n        }\r\n\r\n        public List<ScannedGame> Scan(\r\n            CancellationToken cancelToken,\r\n            out List<Platform> newPlatforms,\r\n            out List<Region> newRegions,\r\n            Action<string> fileScanCallback = null)\r\n        {\r\n            List<ScannedGame> games;\r\n            newPlatforms = new List<Platform>();\r\n            newRegions = new List<Region>();\r\n\r\n            var emulator = database.Emulators[scanner.EmulatorId];\r\n            if (emulator == null)\r\n            {\r\n                throw new Exception(\"Emulator not found.\");\r\n            }\r\n\r\n            if (scanner.EmulatorProfileId.IsNullOrEmpty())\r\n            {\r\n                throw new Exception(\"No emulator profile specified.\");\r\n            }\r\n\r\n            importedFiles = database.GetImportedRomFiles(emulator.InstallDir);\r\n            var globalScanConfig = database.GetGameScannersSettings();\r\n            var crcExclusions = string.Join(\";\",\r\n                ListExtensions.Merge(globalScanConfig.CrcExcludeFileTypes, scanner.CrcExcludeFileTypes).\r\n                Select(a => a.ToLower().Trim()).ToHashSet());\r\n            var dirToScan = PlaynitePaths.ExpandVariables(scanner.Directory, emulator.InstallDir, true);\r\n\r\n            fileExclusions = ParseExclusions(dirToScan, scanner.ExcludedFiles);\r\n            directoryExclusions = ParseExclusions(dirToScan, scanner.ExcludedDirectories);\r\n\r\n            CustomEmulatorProfile customProfile = null;\r","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Emulators/Scanner.cs#L180-L216","documentation":"Thrown as a generic Exception during emulator-based ROM scanning when database.Emulators[scanner.EmulatorId] returns null. The scanner configuration references an emulator by ID that does not exist in the database's Emulators collection, meaning the emulator was deleted, its ID changed, or the scanner config is stale.","triggerScenarios":"Running a GameScanner whose EmulatorId references an emulator that was deleted from the database. Calling the ScanEmulator method with a scanner config whose EmulatorId is a stale Guid from a previous database or a manually-entered invalid ID.","commonSituations":"The user deleted the emulator from Playnite but the scanner config still references it. A database import or sync changed emulator IDs. The scanner was configured on one machine and exported to another where the emulator doesn't exist. A database corruption lost the emulator record.","solutions":["Open the scanner configuration and re-select the emulator from the dropdown to update EmulatorId.","Verify the emulator still exists in Playnite's emulator settings; if deleted, recreate it and update the scanner.","If importing scanner configs from another machine, ensure the same emulators are configured first.","Delete the stale scanner config and recreate it with valid references."],"exampleFix":"// before — scanner references a deleted emulator\nvar emulator = database.Emulators[scanner.EmulatorId];\nif (emulator == null) throw new Exception(\"Emulator not found.\");\n\n// after — validate and guide the user\nvar emulator = database.Emulators[scanner.EmulatorId];\nif (emulator == null)\n{\n    logger.Warn($\"Scanner '{scanner.Name}' references missing emulator {scanner.EmulatorId}.\");\n    // prompt user to reconfigure or skip this scanner\n    continue;\n}","handlingStrategy":"validation","validationCode":"var emulator = database.Emulators[scanner.EmulatorId];\nif (emulator == null)\n{\n    logger.Warn($\"Scanner '{scanner.Name}' references missing emulator {scanner.EmulatorId}.\");\n    continue;\n}","typeGuard":"static bool ScannerEmulatorExists(IGameDatabase database, GameScanner scanner)\n{\n    return database.Emulators[scanner.EmulatorId] != null;\n}","tryCatchPattern":null,"preventionTips":["Validate scanner configs before running a scan batch.","When deleting an emulator, also remove or flag dependent scanners.","Provide a scanner validation UI that shows broken references."],"tags":["emulator","scanner","rom-import","stale-reference","database"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}