AutoDarkMode/Windows-Auto-Night-Mode · warning · SwitchThemeException
Theme switching is unsuccessful: {result}
Error message
Theme switching is unsuccessful: {result} What it means
Same RequestThemeSwitch pattern in ThemePickerViewModel. Thrown when Command.RequestSwitch reply != Ok; Source='ThemePickerViewModel'. Called after color/ignore-color settings are written. Caught locally and routed to ShowErrorMessage.
Source
Thrown at AutoDarkModeApp/ViewModels/ThemePickerViewModel.cs:238
partial void OnIgnoreDesktopIconsEnabledChanged(bool value)
{
WriteSettings();
}
partial void OnIgnoreColorEnabledChanged(bool value)
{
WriteSettings();
}
private async void RequestThemeSwitch()
{
try
{
var result = await MessageHandler.Client.SendMessageAndGetReplyAsync(Command.RequestSwitch, 15);
if (result != StatusCode.Ok)
{
throw new SwitchThemeException(result, "ThemePickerViewModel");
}
}
catch (Exception ex)
{
await _errorService.ShowErrorMessage(ex, App.MainWindow.Content.XamlRoot, "ThemePickerViewModel");
}
}
}
View on GitHub (pinned to c15b28e921)
Solutions
- Ensure no other tool is applying theme/personalization changes simultaneously.
- Verify the service is running and review its log.
- Retry the switch.
- Confirm the 15s timeout is not being exceeded on slow systems.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify accent color / theme settings are coherent before switching
public static bool AccentSettingsValid(AdmConfigBuilder b) =>
b.Config.AutoThemeSwitchingEnabled; Try / catch
// Already caught locally. Refactor to Task-returning if observability needed.
try { await RequestThemeSwitchAsync(); }
catch (SwitchThemeException ex) { /* log ex.Source */ } Prevention
- Ensure no other personalization tool is changing the accent/theme concurrently.
- Debounce OnIgnoreColorEnabledChanged so rapid toggles do not stack switches.
- Confirm the service is running before the picker page loads.
- Review the service log on persistent non-Ok replies.
When it happens
Trigger: ThemePickerViewModel.RequestThemeSwitch() runs after an accent/ignore-color setting change (e.g. OnIgnoreColorEnabledChanged -> WriteSettings -> RequestThemeSwitch). Reply != 'Ok'.
Common situations: Accent color or theme application failed in the service; service busy; timeout; conflicting personalization tools holding registry locks.
Related errors
- Theme switching is unsuccessful: {result}
- Theme switching is unsuccessful: {result}
- Theme switching is unsuccessful: {result}
- Theme switching is unsuccessful: {result}
- Could not add Auto Dark Mode to autostart
AI-assisted analysis of AutoDarkMode/Windows-Auto-Night-Mode@c15b28e921 (2026-08-13).
Data as JSON: /api/errors/23148ea84bbae8e0.
Report an issue: GitHub.