{"record":{"id":"199c24660538eff0","repo":"QL-Win/QuickLook","slug":"thumbs-db-not-found","errorCode":null,"errorMessage":"Thumbs.db not found.","messagePattern":"Thumbs\\.db not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/ThumbsDbExtractor.cs","lineNumber":104,"sourceCode":"        0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,\n        0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2,\n        0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA,\n    ];\n\n    // -- Public API ---------------------------------------------------------------\n\n    /// <summary>\n    /// Extracts all thumbnail images from a Thumbs.db file into\n    /// <paramref name=\"destinationDirectory\"/>, stripping the private Thumbs.db header\n    /// and reconstructing bare-DCT JPEG streams where necessary.\n    /// </summary>\n    public static void ExtractToDirectory(string thumbsDbPath, string destinationDirectory)\n    {\n        if (!Directory.Exists(destinationDirectory))\n            Directory.CreateDirectory(destinationDirectory);\n\n        if (!File.Exists(thumbsDbPath))\n            throw new FileNotFoundException(\"Thumbs.db not found.\", thumbsDbPath);\n\n        using DisposableIStorage storage = new(thumbsDbPath, STGM.READ | STGM.SHARE_DENY_WRITE, IntPtr.Zero);\n        IEnumerator<STATSTG> enumerator = storage.EnumElements();\n\n        while (enumerator.MoveNext())\n        {\n            STATSTG stat = enumerator.Current;\n\n            // Only process stream entries; skip storages and the Catalog metadata stream.\n            if (stat.type != (int)STGTY.STGTY_STREAM)\n                continue;\n            if (stat.pwcsName.Equals(\"Catalog\", StringComparison.OrdinalIgnoreCase))\n                continue;\n\n            try\n            {\n                byte[] raw = ReadStream(storage, stat);\n                (byte[] imageBytes, string ext) = StripHeaderAndDetect(raw);","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/QL-Win/QuickLook/blob/cb5d9c429c81d9796fac469da2a68efb5626946d/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/ThumbsDbExtractor.cs#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check File.Exists(thumbsDbPath) before calling ExtractToDirectory.","Confirm Thumbs.db generation is enabled in Folder Options if you expect the file to exist.","Search the directory for Thumbs.db (case-insensitive) rather than assuming the path.","Catch FileNotFoundException and inform the user no thumbnail cache was found."],"exampleFix":"// before\nThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest);\n\n// after\nif (!File.Exists(thumbsPath))\n    throw new FileNotFoundException($\"Thumbs.db not found: {thumbsPath}\", thumbsPath);\nThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest);","handlingStrategy":"validation","validationCode":"// Ensure Thumbs.db exists before extraction.\npublic static void SafeExtractThumbs(string thumbsDbPath, string dest)\n{\n    if (!File.Exists(thumbsDbPath))\n        throw new FileNotFoundException($\"Thumbs.db not found: {thumbsDbPath}\", thumbsDbPath);\n    ThumbsDbExtractor.ExtractToDirectory(thumbsDbPath, dest);\n}","typeGuard":null,"tryCatchPattern":"try { ThumbsDbExtractor.ExtractToDirectory(thumbsPath, dest); }\ncatch (FileNotFoundException ex) when (ex.FileName == thumbsPath)\n{\n    // No Thumbs.db at that path; inform the user.\n}","preventionTips":["Check File.Exists before calling the extractor.","Be aware Windows 10/11 may not create Thumbs.db in all view modes.","Search the directory case-insensitively for Thumbs.db rather than guessing the path."],"tags":["thumbsdb","ole","io","filenotfound","windows","csharp"],"backgroundTag":null,"analyzedSha":"cb5d9c429c81d9796fac469da2a68efb5626946d","analyzedAt":"2026-08-13T11:51:01.370Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}