AutoDarkMode/Windows-Auto-Night-Mode · warning · SwitchThemeException
Theme switching is unsuccessful: {result}
Error message
Theme switching is unsuccessful: {result} What it means
Identical pattern to error 7 but in CursorsViewModel.RequestThemeSwitch. Thrown when the RequestSwitch reply != Ok. SwitchThemeException carries Source='CursorsViewModel'. The async-void method catches it and routes to ShowErrorMessage. The only difference from other view models is the Source tag used for diagnostics.
Source
Thrown at AutoDarkModeApp/ViewModels/CursorsViewModel.cs:131
_builder.Save();
}
catch (Exception ex)
{
_errorService.ShowErrorMessage(ex, App.MainWindow.Content.XamlRoot, "CursorsPage");
}
RequestThemeSwitch();
}
private async void RequestThemeSwitch()
{
try
{
var result = await MessageHandler.Client.SendMessageAndGetReplyAsync(Command.RequestSwitch, 15);
if (result != StatusCode.Ok)
{
throw new SwitchThemeException(result, "CursorsViewModel");
}
}
catch (Exception ex)
{
await _errorService.ShowErrorMessage(ex, App.MainWindow.Content.XamlRoot, "CursorsViewModel");
}
}
}View on GitHub (pinned to c15b28e921)
Solutions
- Ensure the service is running and not mid-switch.
- Check the service log filtered by the cursors component.
- Retry the switch; transient OS cursor-file locks can cause a one-off failure.
- Verify cursor theme files referenced in config exist on disk.
Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm cursor theme files exist before requesting a switch
public static bool CursorFilesExist(AdmConfigBuilder b) =>
b.Config.CursorsSwitch.Component.Paths.All(File.Exists); Try / catch
// Already caught locally. To surface the failure to callers, change // 'async void RequestThemeSwitch()' to 'async Task RequestThemeSwitchAsync()' // and await it so the caller can catch SwitchThemeException.
Prevention
- Validate configured cursor file paths exist before switching.
- Ensure no other tool is applying cursor themes simultaneously.
- Debounce repeated switch requests from rapid UI changes.
- Check the service log filtered by the cursors component on failure.
When it happens
Trigger: CursorsViewModel.RequestThemeSwitch() fires after a cursor-related setting change. The service reply to Command.RequestSwitch (15s timeout) is not 'Ok'.
Common situations: Cursor theme switch component failed in the service; service busy/unreachable; 15s timeout exceeded; a dependent OS cursor API returned an error.
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/6f42f973dc761c54.
Report an issue: GitHub.