{"record":{"id":"774085de70303dd9","repo":"JosefNemec/Playnite","slug":"assigned-built-in-emulator-profile-not-found","errorCode":null,"errorMessage":"Assigned built-in emulator profile not found.","messagePattern":"Assigned built-in emulator profile not found\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Emulators/Scanner.cs","lineNumber":243,"sourceCode":"                }\r\n\r\n                games = ScanDirectory(\r\n                    dirToScan,\r\n                    emulator,\r\n                    customProfile,\r\n                    cancelToken,\r\n                    crcExclusions,\r\n                    scanner.ScanSubfolders,\r\n                    scanner.ScanInsideArchives,\r\n                    scanner.MergeRelatedFiles,\r\n                    fileScanCallback);\r\n            }\r\n            else if (scanner.EmulatorProfileId.StartsWith(BuiltInEmulatorProfile.ProfilePrefix, StringComparison.Ordinal))\r\n            {\r\n                builtinProfile = emulator.BuiltinProfiles?.FirstOrDefault(a => a.Id == scanner.EmulatorProfileId);\r\n                if (builtinProfile == null)\r\n                {\r\n                    throw new Exception(\"Assigned built-in emulator profile not found.\");\r\n                }\r\n\r\n                builtinProfileDef = Emulation.GetProfile(emulator.BuiltInConfigId, builtinProfile.BuiltInProfileName);\r\n                if (builtinProfileDef == null)\r\n                {\r\n                    throw new Exception(\"Assigned built-in emulator profile definition not found.\");\r\n                }\r\n\r\n                games = ScanDirectory(\r\n                    dirToScan,\r\n                    emulator,\r\n                    builtinProfile,\r\n                    cancelToken,\r\n                    crcExclusions,\r\n                    scanner.ScanSubfolders,\r\n                    scanner.ScanInsideArchives,\r\n                    scanner.MergeRelatedFiles,\r\n                    fileScanCallback);\r","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Emulators/Scanner.cs#L225-L261","documentation":"Thrown as a generic Exception during emulator-based ROM scanning when EmulatorProfileId starts with BuiltInEmulatorProfile.ProfilePrefix (indicating it should be a built-in profile) but no matching profile is found in emulator.BuiltinProfiles. The scanner expects a built-in emulator profile (e.g., a standard config like 'Snes9x Default') that does not exist in the current emulator's BuiltinProfiles collection.","triggerScenarios":"scanner.EmulatorProfileId starts with BuiltInEmulatorProfile.ProfilePrefix and FirstOrDefault against emulator.BuiltinProfiles returns null. This means the built-in profile ID is correctly prefixed but the corresponding profile record is not attached to this emulator instance.","commonSituations":"The emulator definition was updated and the built-in profile ID or name changed. The emulator was reconfigured and the built-in profiles were regenerated with new IDs. The scanner was exported from a different Playnite version with different built-in definitions. A database migration changed profile IDs. The built-in profile was removed from the emulator definition pack.","solutions":["Open the scanner configuration and re-select the built-in emulator profile from the dropdown.","Update Playnite and the emulator definitions pack: a stale definition may have renamed or removed the profile.","Check the emulator's BuiltinProfiles in Playnite settings to see which built-in profiles are available.","Delete the stale scanner and recreate it with a currently valid built-in profile."],"exampleFix":"// before — scanner references a built-in profile that no longer exists\nscanner.EmulatorProfileId = \"builtin_snes9x_default_v1\"; // renamed in new definition\nRunScan(scanner); // throws\n\n// after — validate profile existence and guide reconfiguration\nvar builtinProfile = emulator.BuiltinProfiles?.FirstOrDefault(p => p.Id == scanner.EmulatorProfileId);\nif (builtinProfile == null)\n{\n    logger.Warn($\"Built-in profile {scanner.EmulatorProfileId} not found on emulator {emulator.Name}. \" +\n                \"Available: {string.Join(\", \", emulator.BuiltinProfiles?.Select(p => p.Id) ?? new List<string>())}\");\n    return;\n}\nRunScan(scanner);","handlingStrategy":"validation","validationCode":"var builtinProfile = emulator.BuiltinProfiles?.FirstOrDefault(p => p.Id == scanner.EmulatorProfileId);\nif (builtinProfile == null)\n{\n    logger.Warn($\"Built-in profile {scanner.EmulatorProfileId} not found on emulator {emulator.Name}. \" +\n                $\"Available: {string.Join(\", \", emulator.BuiltinProfiles?.Select(p => p.Id) ?? Enumerable.Empty<string>())}\");\n    continue;\n}","typeGuard":"static bool BuiltinProfileExists(Emulator emulator, string profileId)\n{\n    return emulator.BuiltinProfiles?.Any(p => p.Id == profileId) == true;\n}","tryCatchPattern":null,"preventionTips":["After updating emulator definitions, validate all scanner profile references.","Keep emulator definition packs updated alongside Playnite.","Log available built-in profile IDs when a lookup fails to help the user reconfigure."],"tags":["emulator","scanner","rom-import","stale-reference","emulator-profile","builtin-profile"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}