QuickLook Thumbnailing returns stale macOS 26 folder icon

On macOS 26, I've run into a situation when a user “customizes” a folder icon with Finder by assigning/changing an SF Symbol or an emoji, QLThumbnailGenerator keeps returning the stale initially retrieved folder icon (no matter whether it had been customized or not) until my app quits. After the app is re-launched, the icon is correctly retrieved once again.

let generator = QLThumbnailGenerator.shared
let size: CGSize = CGSize(width: 64, height: 64)
let request = QLThumbnailGenerator.Request(fileAt: url, size: size, scale: NSScreen.main!.backingScaleFactor, representationTypes: .icon)
request.iconMode = true
do {
    let thumb = try await generator.generateBestRepresentation(for: request)
    thumb.nsImage.size = size
    return thumb.nsImage
} catch {
    print("generateThumbnail: \(error)")
    return nil
}

It seems like the QuickLook Thumbnailing cache does not invalidate automatically upon folder customization. Is there any way to manually invalidate the QuickLook Thumbnailing cache?

QuickLook Thumbnailing returns stale macOS 26 folder icon
 
 
Q