{"record":{"id":"f251196db0456776","repo":"JosefNemec/Playnite","slug":"no-emulator-profile-specified","errorCode":null,"errorMessage":"No emulator profile specified.","messagePattern":"No emulator profile specified\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Emulators/Scanner.cs","lineNumber":203,"sourceCode":"        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\n            BuiltInEmulatorProfile builtinProfile = null;\r\n            EmulatorDefinitionProfile builtinProfileDef = null;\r\n            if (scanner.EmulatorProfileId.StartsWith(CustomEmulatorProfile.ProfilePrefix, StringComparison.Ordinal))\r\n            {\r\n                customProfile = emulator.CustomProfiles?.FirstOrDefault(a => a.Id == scanner.EmulatorProfileId);\r","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Emulators/Scanner.cs#L185-L221","documentation":"Thrown as a generic Exception during emulator-based ROM scanning when scanner.EmulatorProfileId is null or empty (checked via IsNullOrEmpty). The scanner requires both an emulator ID and a specific emulator profile ID to know how to launch and identify games. Without a profile, the scanner cannot determine executable paths, arguments, or ROM detection rules.","triggerScenarios":"Running a GameScanner where EmulatorProfileId was never set, was cleared, or is empty. This is a configuration completeness check: the scanner form requires selecting an emulator profile before saving.","commonSituations":"The scanner was created programmatically or imported without a profile ID. The profile was deleted and the scanner config was not updated. The scanner config was edited manually or via API without setting EmulatorProfileId. A UI bug allowed saving an incomplete scanner configuration.","solutions":["Open the scanner configuration and select an emulator profile from the dropdown.","If the referenced profile was deleted, select a new one or recreate the deleted profile.","If creating scanners programmatically, always set EmulatorProfileId before saving.","Validate scanner configs on load and flag/skip incomplete ones."],"exampleFix":"// before — scanner without profile ID\nvar scanner = new GameScanner { Name = \"SNES Roms\", EmulatorId = emu.Id }; // no EmulatorProfileId\nRunScan(scanner);\n\n// after — always set the profile\nvar scanner = new GameScanner\n{\n    Name = \"SNES Roms\",\n    EmulatorId = emu.Id,\n    EmulatorProfileId = emu.CustomProfiles.First().Id // explicitly set\n};\nRunScan(scanner);","handlingStrategy":"validation","validationCode":"if (scanner.EmulatorProfileId.IsNullOrEmpty())\n{\n    logger.Warn($\"Scanner '{scanner.Name}' has no emulator profile specified.\");\n    continue;\n}","typeGuard":"static bool HasValidProfileId(GameScanner scanner)\n{\n    return !scanner.EmulatorProfileId.IsNullOrEmpty();\n}","tryCatchPattern":null,"preventionTips":["Require EmulatorProfileId in the scanner editor UI before saving.","Validate scanner configs programmatically before batch scan runs.","Skip and log incomplete scanners rather than crashing the entire scan."],"tags":["emulator","scanner","rom-import","validation","emulator-profile"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}