JosefNemec/Playnite · error · Exception

Assigned custom emulator profile not found.

Error message

Assigned custom emulator profile not found.

What it means

Thrown as a generic Exception during emulator-based ROM scanning when the EmulatorProfileId starts with the CustomEmulatorProfile.ProfilePrefix (indicating it should be a custom profile) but no matching profile is found in emulator.CustomProfiles. The scanner references a specific custom emulator profile by ID that either was deleted or never existed for this emulator.

Source

Thrown at source/Playnite/Emulators/Scanner.cs:224

            importedFiles = database.GetImportedRomFiles(emulator.InstallDir);
            var globalScanConfig = database.GetGameScannersSettings();
            var crcExclusions = string.Join(";",
                ListExtensions.Merge(globalScanConfig.CrcExcludeFileTypes, scanner.CrcExcludeFileTypes).
                Select(a => a.ToLower().Trim()).ToHashSet());
            var dirToScan = PlaynitePaths.ExpandVariables(scanner.Directory, emulator.InstallDir, true);

            fileExclusions = ParseExclusions(dirToScan, scanner.ExcludedFiles);
            directoryExclusions = ParseExclusions(dirToScan, scanner.ExcludedDirectories);

            CustomEmulatorProfile customProfile = null;
            BuiltInEmulatorProfile builtinProfile = null;
            EmulatorDefinitionProfile builtinProfileDef = null;
            if (scanner.EmulatorProfileId.StartsWith(CustomEmulatorProfile.ProfilePrefix, StringComparison.Ordinal))
            {
                customProfile = emulator.CustomProfiles?.FirstOrDefault(a => a.Id == scanner.EmulatorProfileId);
                if (customProfile == null)
                {
                    throw new Exception("Assigned custom emulator profile not found.");
                }

                games = ScanDirectory(
                    dirToScan,
                    emulator,
                    customProfile,
                    cancelToken,
                    crcExclusions,
                    scanner.ScanSubfolders,
                    scanner.ScanInsideArchives,
                    scanner.MergeRelatedFiles,
                    fileScanCallback);
            }
            else if (scanner.EmulatorProfileId.StartsWith(BuiltInEmulatorProfile.ProfilePrefix, StringComparison.Ordinal))
            {
                builtinProfile = emulator.BuiltinProfiles?.FirstOrDefault(a => a.Id == scanner.EmulatorProfileId);
                if (builtinProfile == null)
                {

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Open the scanner configuration and re-select the custom emulator profile from the dropdown.
  2. If the profile was deleted, recreate it with the same settings and update the scanner to reference the new profile.
  3. Verify the emulator's CustomProfiles collection contains the expected profile: check emulator settings in Playnite.
  4. Delete the stale scanner and recreate it with valid references.

Example fix

// before — scanner references a deleted custom profile
scanner.EmulatorProfileId = "custom-abc123"; // profile no longer exists
RunScan(scanner); // throws

// after — validate profile existence before scanning
var profile = emulator.CustomProfiles?.FirstOrDefault(p => p.Id == scanner.EmulatorProfileId);
if (profile == null)
{
    logger.Warn($"Custom profile {scanner.EmulatorProfileId} not found; please reconfigure scanner.");
    return;
}
RunScan(scanner);
Defensive patterns

Strategy: validation

Validate before calling

var customProfile = emulator.CustomProfiles?.FirstOrDefault(p => p.Id == scanner.EmulatorProfileId);
if (customProfile == null)
{
    logger.Warn($"Custom profile {scanner.EmulatorProfileId} not found on emulator {emulator.Name}.");
    continue;
}

Type guard

static bool CustomProfileExists(Emulator emulator, string profileId)
{
    return emulator.CustomProfiles?.Any(p => p.Id == profileId) == true;
}

Prevention

When it happens

Trigger: scanner.EmulatorProfileId starts with CustomEmulatorProfile.ProfilePrefix and a FirstOrDefault lookup against emulator.CustomProfiles returns null. The profile ID is well-formed (correct prefix) but the profile record itself is missing from the emulator's CustomProfiles collection.

Common situations: The custom emulator profile was deleted by the user but the scanner still references its ID. The scanner was imported from another database where the profile existed. A database sync or migration lost the CustomProfiles entry. The profile ID was typed or set programmatically with a value that doesn't match any stored profile.

Related errors


AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13). Data as JSON: /api/errors/334186dc27a5697c. Report an issue: GitHub.