JosefNemec/Playnite · warning · Exception
Uknown file exclusion configuration.
Error message
Uknown file exclusion configuration.
What it means
Thrown as a dead-code defensive guard in GetFileExclusionMatches. Because the preceding branches are if(MatchByRegex) / else if(Absolute) / else if(!Absolute), the final else is logically unreachable — every ScanExclusion is either absolute or not. This throw exists to catch a logic regression rather than a real runtime input; it fires only if the Absolute flag semantics become non-boolean or branch ordering is broken.
Source
Thrown at source/Playnite/Emulators/Scanner.cs:483
matches.AddMissing(match);
}
else if (excFile.Absolute)
{
var match = files.FirstOrDefault(a => a.Equals(excFile.Path, StringComparison.OrdinalIgnoreCase));
if (match != null)
{
matches.AddMissing(match);
}
}
else if (!excFile.Absolute)
{
var comp = excFile.Path.PrefixWithDirSeparator();
var match = files.Where(a => a.EndsWith(comp, StringComparison.OrdinalIgnoreCase));
matches.AddMissing(match);
}
else
{
throw new Exception("Uknown file exclusion configuration.");
}
}
return matches;
}
public static List<string> GetDirectoryExclusionMatches(List<string> dirs, List<ScanExclusion> exclusions)
{
var matches = new List<string>();
foreach (var excDir in exclusions)
{
if (excDir.MatchByRegex)
{
// exclusion parser already appends root path if needed so same match can be done here
// for any level match and absolute path match
var match = dirs.Where(a => Regex.IsMatch(a.TrimEnd(Paths.DirectorySeparators), excDir.Path, RegexOptions.IgnoreCase));
matches.AddMissing(match);
}
View on GitHub (pinned to 5911f4e964)
Solutions
- No action needed for callers — this branch is unreachable with boolean Absolute.
- If encountered during development, audit recent edits to ScanExclusion.Absolute and the if/else chain ordering in GetFileExclusionMatches.
- Consider removing the dead branch or converting it to an assertion to clarify intent.
Example fix
// before
else if (!excFile.Absolute) { ... }
else { throw new Exception("Uknown file exclusion configuration."); }
// after — collapse the redundant else-if into a final else
else { var comp = excFile.Path.PrefixWithDirSeparator(); matches.AddMissing(files.Where(a => a.EndsWith(comp, StringComparison.OrdinalIgnoreCase))); } Defensive patterns
Strategy: validation
Validate before calling
// Unreachable for boolean Absolute; no caller validation needed. For safety, assert the type. Debug.Assert(excFile.Absolute is bool, "ScanExclusion.Absolute must be boolean");
Prevention
- Treat this branch as dead code during reviews; it indicates a logic bug if hit.
- Keep ScanExclusion.Absolute as a non-nullable boolean.
- Add a unit test asserting every combination of (MatchByRegex, Absolute) is handled by an earlier branch.
When it happens
Trigger: Theoretically unreachable for any boolean Absolute value: the !Absolute branch (line 475) already covers the false case, so the trailing else can never evaluate. Would only trigger if Absolute were changed to a nullable/non-bool type or the branch conditions were reordered incorrectly.
Common situations: Not hit in normal operation. A maintainer refactoring the exclusion logic could accidentally make it reachable; otherwise it is vestigial defensive code.
Related errors
- Emulator not found.
- No emulator profile specified.
- Assigned custom emulator profile not found.
- Assigned built-in emulator profile not found.
- Assigned built-in emulator profile definition not found.
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/33b0ec468ac178d5.
Report an issue: GitHub.