QL-Win/QuickLook · error · FileNotFoundException

Thumbs.db not found.

Error message

Thumbs.db not found.

What it means

Thrown by ThumbsDbExtractor.ExtractToDirectory when File.Exists(thumbsDbPath) is false. Thumbs.db files are OLE compound files generated by Windows Explorer for thumbnail caching; this guard fires before any OLE storage is opened.

Source

Thrown at QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/ThumbsDbExtractor.cs:104

        0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
        0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2,
        0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA,
    ];

    // -- Public API ---------------------------------------------------------------

    /// <summary>
    /// Extracts all thumbnail images from a Thumbs.db file into
    /// <paramref name="destinationDirectory"/>, stripping the private Thumbs.db header
    /// and reconstructing bare-DCT JPEG streams where necessary.
    /// </summary>
    public static void ExtractToDirectory(string thumbsDbPath, string destinationDirectory)
    {
        if (!Directory.Exists(destinationDirectory))
            Directory.CreateDirectory(destinationDirectory);

        if (!File.Exists(thumbsDbPath))
            throw new FileNotFoundException("Thumbs.db not found.", thumbsDbPath);

        using DisposableIStorage storage = new(thumbsDbPath, STGM.READ | STGM.SHARE_DENY_WRITE, IntPtr.Zero);
        IEnumerator<STATSTG> enumerator = storage.EnumElements();

        while (enumerator.MoveNext())
        {
            STATSTG stat = enumerator.Current;

            // Only process stream entries; skip storages and the Catalog metadata stream.
            if (stat.type != (int)STGTY.STGTY_STREAM)
                continue;
            if (stat.pwcsName.Equals("Catalog", StringComparison.OrdinalIgnoreCase))
                continue;

            try
            {
                byte[] raw = ReadStream(storage, stat);
                (byte[] imageBytes, string ext) = StripHeaderAndDetect(raw);

View on GitHub (pinned to cb5d9c429c)

Solutions

  1. Check File.Exists(thumbsDbPath) before calling ExtractToDirectory.
  2. Confirm Thumbs.db generation is enabled in Folder Options if you expect the file to exist.
  3. Search the directory for Thumbs.db (case-insensitive) rather than assuming the path.
  4. Catch FileNotFoundException and inform the user no thumbnail cache was found.

Example fix

// before
ThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest);

// after
if (!File.Exists(thumbsPath))
    throw new FileNotFoundException($"Thumbs.db not found: {thumbsPath}", thumbsPath);
ThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest);
Defensive patterns

Strategy: validation

Validate before calling

// Ensure Thumbs.db exists before extraction.
public static void SafeExtractThumbs(string thumbsDbPath, string dest)
{
    if (!File.Exists(thumbsDbPath))
        throw new FileNotFoundException($"Thumbs.db not found: {thumbsDbPath}", thumbsDbPath);
    ThumbsDbExtractor.ExtractToDirectory(thumbsDbPath, dest);
}

Try / catch

try { ThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest); }
catch (FileNotFoundException ex) when (ex.FileName == thumbsPath)
{
    // No Thumbs.db at that path; inform the user.
}

Prevention

When it happens

Trigger: Calling ExtractToDirectory(thumbsDbPath, destinationDirectory) with a path to a Thumbs.db that does not exist: the file was cleared by Windows, the path is wrong, or 'Hide protected OS files' masked it and the caller guessed the path.

Common situations: Windows 10/11 no longer creates Thumbs.db in the same way (or at all for some view modes); the file was deleted by disk cleanup; path typed manually without confirming visibility; network drive where Thumbs.db was never generated.

Related errors


AI-assisted analysis of QL-Win/QuickLook@cb5d9c429c (2026-08-13). Data as JSON: /api/errors/199c24660538eff0. Report an issue: GitHub.