{"record":{"id":"73ed363005a6ec80","repo":"JosefNemec/Playnite","slug":"emulator-profile-format-not-supported","errorCode":null,"errorMessage":"Emulator profile format not supported.","messagePattern":"Emulator profile format not supported\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Emulators/Scanner.cs","lineNumber":265,"sourceCode":"                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\n            }\r\n            else\r\n            {\r\n                throw new Exception(\"Emulator profile format not supported.\");\r\n            }\r\n\r\n            foreach (var game in games)\r\n            {\r\n                game.SourceEmulator = emulator;\r\n                game.SourceConfig = scanner;\r\n                var assignedRegions = new List<EmulatedRegion>();\r\n                var assignedPlatforms = new List<EmulatedPlatform>();\r\n                foreach (var rom in game.Roms)\r\n                {\r\n                    // REGIONS\r\n                    if (rom.DbData?.Region.IsNullOrEmpty() == false)\r\n                    {\r\n                        var region = Emulation.GetRegionByCode(rom.DbData.Region);\r\n                        if (region != null)\r\n                        {\r\n                            assignedRegions.AddMissing(region);\r\n                        }\r","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Emulators/Scanner.cs#L247-L283","documentation":"Thrown as the terminal else-branch when a ScanConfig.EmulatorProfileId matches neither the custom profile prefix (CustomEmulatorProfile.ProfilePrefix) nor the built-in profile prefix (BuiltInEmulatorProfile.ProfilePrefix). It signals an unrecognizable profile-id format that the scanner cannot dispatch on. This is effectively an exhaustiveness guard over the two supported profile-id shapes.","triggerScenarios":"ScanDirectory is invoked with a scanner.EmulatorProfileId that does not start with CustomEmulatorProfile.ProfilePrefix or BuiltInEmulatorProfile.ProfilePrefix — e.g. a null, empty, corrupted, or hand-edited id with an unknown prefix.","commonSituations":"Database corruption or manual DB edits producing a malformed EmulatorProfileId; an older/newer Playnite version wrote a profile id format the current build doesn't recognize; serialization glitch leaving the id blank.","solutions":["Validate that scanner.EmulatorProfileId starts with one of the two known prefixes before calling ScanDirectory.","Re-save the scan configuration through the UI to regenerate a well-formed profile id.","If migrating between Playnite versions, run the config migration so profile ids are normalized to the current prefix scheme."],"exampleFix":"// before\nelse {\n    throw new Exception(\"Emulator profile format not supported.\");\n}\n\n// after — explicit prefix dispatch with logging\nif (scanner.EmulatorProfileId.IsNullOrEmpty()) {\n    logger.Error(\"ScanConfig has no EmulatorProfileId; cannot scan.\");\n    return new List<ScannedGame>();\n}\nif (!scanner.EmulatorProfileId.StartsWith(CustomEmulatorProfile.ProfilePrefix, StringComparison.Ordinal) &&\n    !scanner.EmulatorProfileId.StartsWith(BuiltInEmulatorProfile.ProfilePrefix, StringComparison.Ordinal)) {\n    logger.Error($\"Unrecognized profile id format: {scanner.EmulatorProfileId}\");\n    return new List<ScannedGame>();\n}","handlingStrategy":"validation","validationCode":"// Ensure the profile id uses a recognized prefix before dispatching.\nif (scanner.EmulatorProfileId.IsNullOrEmpty()\n    || (!scanner.EmulatorProfileId.StartsWith(CustomEmulatorProfile.ProfilePrefix, StringComparison.Ordinal)\n        && !scanner.EmulatorProfileId.StartsWith(BuiltInEmulatorProfile.ProfilePrefix, StringComparison.Ordinal))) {\n    logger.Error($\"Unrecognized profile id: {scanner.EmulatorProfileId}\");\n    return;\n}","typeGuard":"static bool IsValidProfileIdFormat(string id) =>\n    !id.IsNullOrEmpty() &&\n    (id.StartsWith(CustomEmulatorProfile.ProfilePrefix, StringComparison.Ordinal) ||\n     id.StartsWith(BuiltInEmulatorProfile.ProfilePrefix, StringComparison.Ordinal));","tryCatchPattern":null,"preventionTips":["Always create scan configs through the UI so profile ids carry the correct prefix.","On DB load, validate every ScanConfig.EmulatorProfileId prefix and quarantine invalid ones.","Never hand-edit profile ids in the database."],"tags":["emulator","scanner","validation","exhaustiveness"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}