Flow-Launcher/Flow.Launcher · warning · InvalidOperationException
Failed to get thumbnail
Error message
Failed to get thumbnail
What it means
Thrown as InvalidOperationException wrapping any exception from imageFactory.GetImage that is NOT one of the explicitly handled fallback cases (COMException with PATHNOTFOUND/EXTRACTIONFAILED under ThumbnailOnly, or FileNotFoundException under ThumbnailOnly). It is the catch-all for thumbnail extraction failures not covered by the IconOnly fallback path.
Source
Thrown at Flow.Launcher.Infrastructure/Image/ThumbnailReader.cs:131
try
{
imageFactory.GetImage(size, (SIIGBF)options, &hBitmap);
}
catch (COMException ex) when (options == ThumbnailOptions.ThumbnailOnly &&
(ex.HResult == S_PATHNOTFOUND || ex.HResult == S_EXTRACTIONFAILED))
{
// Fallback to IconOnly if extraction fails or files cannot be found
imageFactory.GetImage(size, (SIIGBF)ThumbnailOptions.IconOnly, &hBitmap);
}
catch (FileNotFoundException) when (options == ThumbnailOptions.ThumbnailOnly)
{
// Fallback to IconOnly if files cannot be found
imageFactory.GetImage(size, (SIIGBF)ThumbnailOptions.IconOnly, &hBitmap);
}
catch (System.Exception ex)
{
// Handle other exceptions
throw new InvalidOperationException("Failed to get thumbnail", ex);
}
}
finally
{
if (shellItem != null)
{
Marshal.ReleaseComObject(shellItem);
}
}
return hBitmap;
}
/// <summary>
/// Obtains an HBITMAP for a Windows .url shortcut by resolving its IconFile entry and delegating to GetHBitmap.
/// </summary>
/// <remarks>
/// The method parses the .url file as an INI, looks in the "InternetShortcut" section for the "IconFile" entry,View on GitHub (pinned to 7fc63b07bb)
Solutions
- Inspect the InnerException — it carries the original HRESULT/exception that names the failing provider.
- Catch this InvalidOperationException at the caller and fall back to a static placeholder icon.
- If reproducible for one file, that file's thumbnail provider is likely broken — re-associate or repair the codec.
- Run the thumbnail/icon cache rebuild (Disk Cleanup) to clear stale cache entries.
Example fix
// before — catch-all rethrow
catch (System.Exception ex)
{
throw new InvalidOperationException("Failed to get thumbnail", ex);
}
// after — log and return a sentinel so the caller can fall back
catch (System.Exception ex)
{
Log.Exception(nameof(ThumbnailReader), $"GetImage failed for {fileName}", ex);
return HBITMAP.Null;
} Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try { return ThumbnailReader.GetThumbnail(fileName, w, h, options); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Failed to get thumbnail"))
{ Log.Exception(ClassName, $"Thumbnail failed for {fileName}", ex.InnerException); return fallbackIcon; } Prevention
- Catch InvalidOperationException at the caller and fall back to a placeholder.
- Inspect InnerException for the failing provider/HRESULT.
- Rebuild the thumbnail/icon cache (Disk Cleanup) if failures are widespread.
- Avoid requesting thumbnails for known-corrupt or locked files.
When it happens
Trigger: GetImage throws an OutOfMemoryException, an access-denied COMException (different HRESULT), an SEHException, or any other exception type while in non-ThumbnailOnly mode (so the fallback clauses don't match); the thumbnail provider crashes for a corrupt media file; insufficient privileges to read the file's thumbnail cache.
Common situations: Corrupt image/video/PDF whose thumbnail extractor (e.g. codec) crashes; a file locked exclusively by another process; a shell extension/thumbnail provider that is broken or unregistered; large files whose extractor times out internally.
Related errors
- Failed to get IShellItemImageFactory
- Failed to parse folder path
- Failed to parse file path
- Failed to open folder and select item
- Failed to get the desktop shell folder
AI-assisted analysis of Flow-Launcher/Flow.Launcher@7fc63b07bb (2026-08-13).
Data as JSON: /api/errors/02096620f26f9ade.
Report an issue: GitHub.