Flow-Launcher/Flow.Launcher · warning · InvalidOperationException
Invalid corner type
Error message
Invalid corner type
What it means
Thrown as InvalidOperationException from DWMSetCornerPreferenceForWindow when the supplied cornerType string does not match any of the four accepted literal values: 'DoNotRound', 'Round', 'RoundSmall', 'Default'. The switch expression's default arm throws because the value cannot be mapped to a DWM_WINDOW_CORNER_PREFERENCE enum.
Source
Thrown at Flow.Launcher.Infrastructure/Win32Helper.cs:105
&darkMode,
(uint)Marshal.SizeOf<int>()).Succeeded;
}
/// <summary>
///
/// </summary>
/// <param name="window"></param>
/// <param name="cornerType">DoNotRound, Round, RoundSmall, Default</param>
/// <returns></returns>
public static unsafe bool DWMSetCornerPreferenceForWindow(Window window, string cornerType)
{
var preference = cornerType switch
{
"DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DONOTROUND,
"Round" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND,
"RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUNDSMALL,
"Default" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DEFAULT,
_ => throw new InvalidOperationException("Invalid corner type")
};
return PInvoke.DwmSetWindowAttribute(
GetWindowHandle(window),
DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE,
&preference,
(uint)Marshal.SizeOf<int>()).Succeeded;
}
#endregion
#region Wallpaper
public static unsafe string GetWallpaperPath()
{
var wallpaperPtr = stackalloc char[(int)PInvoke.MAX_PATH];
PInvoke.SystemParametersInfo(SYSTEM_PARAMETERS_INFO_ACTION.SPI_GETDESKWALLPAPER, PInvoke.MAX_PATH,
wallpaperPtr,View on GitHub (pinned to 7fc63b07bb)
Solutions
- Set WindowCornerType to one of the exact literals: 'DoNotRound', 'Round', 'RoundSmall', or 'Default' (case-sensitive).
- If loading from a theme/settings file, validate the value against the allowed set before calling this method.
- Update Flow Launcher to a version that supports the corner type you intend to use.
- Reset the setting to 'Default' and re-apply.
Example fix
// before
var preference = cornerType switch
{
"DoNotRound" => ..., "Round" => ..., "RoundSmall" => ..., "Default" => ...,
_ => throw new InvalidOperationException("Invalid corner type")
};
// after — case-insensitive match with a safe default + log
var preference = cornerType?.Trim() switch
{
"DoNotRound" or "donotround" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DONOTROUND,
"Round" or "round" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND,
"RoundSmall" or "roundsmall" => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUNDSMALL,
_ => DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DEFAULT
}; Defensive patterns
Strategy: validation
Validate before calling
var allowed = new[] { "DoNotRound", "Round", "RoundSmall", "Default" };
if (!allowed.Contains(cornerType))
{ Log.Warn(...); cornerType = "Default"; } Type guard
static bool IsValidCornerType(string s) =>
s is "DoNotRound" or "Round" or "RoundSmall" or "Default"; Try / catch
try { Win32Helper.DWMSetCornerPreferenceForWindow(window, cornerType); }
catch (InvalidOperationException) { Win32Helper.DWMSetCornerPreferenceForWindow(window, "Default"); } Prevention
- Restrict theme/settings corner values to the four exact literals.
- Validate the value against an allow-list before calling the API.
- Avoid hand-editing settings.json for UI prefs; use the Settings UI.
- Reset to 'Default' when in doubt.
When it happens
Trigger: A theme XAML or settings value specifies a WindowCornerType that is misspelled, differently cased (e.g. 'round', 'donotround'), localized, or a legacy value from an older version; a user hand-edited settings.json and typed an invalid corner type; a future version adds a new corner type string that this build doesn't recognize.
Common situations: Manual settings.json edit with a typo or wrong case; theme authored against a newer Flow Launcher version using a corner name not yet supported; locale-specific value ('Redondo') accidentally saved; copy-paste of a corner name from docs that don't match the code's literals.
Related errors
- Theme path can't be found <{path}>
- DoublePinyinSchema '{schemaKey}' is invalid or double pinyin
- The zip file does not contain a plugin.json file.
- Invalid SVG dimensions: Height must be greater than zero in
- Failed to get IShellItemImageFactory
AI-assisted analysis of Flow-Launcher/Flow.Launcher@7fc63b07bb (2026-08-13).
Data as JSON: /api/errors/773b1c1e69d9713c.
Report an issue: GitHub.