JosefNemec/Playnite · error · Exception
No profile provided.
Error message
No profile provided.
What it means
Thrown by the ScanDirectory overload accepting a CustomEmulatorProfile when the caller passes null. It is a null-argument guard: the method dereferences profile.ImageExtensions and profile.Platforms immediately after, so a null profile must be rejected before use.
Source
Thrown at source/Playnite/Emulators/Scanner.cs:630
mergeRelatedFiles,
fileScanCallback);
}
}
private List<ScannedGame> ScanDirectory(
string directory,
Emulator emulator,
CustomEmulatorProfile profile,
CancellationToken cancelToken,
string crcExludePatterns,
bool scanSubfolders,
bool scanArchives,
bool mergeRelatedFiles,
Action<string> fileScanCallback = null)
{
if (profile == null)
{
throw new Exception($"No profile provided.");
}
if (!profile.ImageExtensions.HasItems())
{
return new List<ScannedGame>();
}
var platforms = profile.Platforms?.Select(a => database.Platforms[a]?.SpecificationId).Where(a => !a.IsNullOrEmpty()).ToList();
return ScanDirectory(
directory,
profile.ImageExtensions.Select(a => a.Trim()).ToList(),
platforms,
cancelToken,
crcExludePatterns,
scanSubfolders,
scanArchives,
mergeRelatedFiles,
fileScanCallback);
View on GitHub (pinned to 5911f4e964)
Solutions
- Resolve the CustomEmulatorProfile by id before calling and skip/handle if null rather than passing null.
- Add a null-check at the call site and log a warning instead of propagating null into ScanDirectory.
- Use ArgumentNullException to make the contract explicit.
Example fix
// before
if (profile == null) { throw new Exception($"No profile provided."); }
// after
if (profile == null) { throw new ArgumentNullException(nameof(profile), "A CustomEmulatorProfile must be supplied to scan."); } Defensive patterns
Strategy: validation
Validate before calling
// Resolve and null-check the custom profile before scanning.
var profile = emulator.CustomProfiles?.FirstOrDefault(p => p.Id == scanner.EmulatorProfileId);
if (profile == null) { logger.Warn("Custom profile missing; skip scan."); return; } Type guard
static bool HasCustomProfile(Emulator emu, string id) =>
emu.CustomProfiles?.Any(p => p.Id == id) == true; Prevention
- Never pass unresolved profile lookups directly into ScanDirectory.
- Use ArgumentNullException for null profile arguments to make contracts explicit.
- In the scan UI, disable the scan button until a profile is selected.
When it happens
Trigger: Calling ScanDirectory(directory, emulator, profile, ...) with profile == null. Typically the result of a lookup like emulator.CustomProfiles?.FirstOrDefault(...) returning null and being passed through without a check.
Common situations: A scan configuration references a custom profile id that no longer exists on the emulator; a code path that creates a scanner without resolving its profile; UI flow that allows starting a scan before a profile is selected.
Related errors
- No emulator profile specified.
- Emulator profile format not supported.
- Emulator not found.
- Uknown play action configuration.
- Can't find built-in {builtIn.BuiltInProfileName} emulator pr
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/1ee8f52057a7ea14.
Report an issue: GitHub.