[Windows] Saving a generated image via context menu throws `setProgressBar is not a function`

Open 💬 3 comments Opened Aug 26, 2026 by koprivnikarurnaa-oss

Summary

On the current Windows stable ChatGPT/Codex desktop build, saving a generated chat image through the native context menu (right-click image → Save Image As…) raises an uncaught exception in the main process:

Uncaught Exception:
TypeError: h.setProgressBar is not a function
    at DownloadItem.<anonymous> (...app.asar:289166)
    at DownloadItem.emit (node:events:508:28)

This started after updating to the unified ChatGPT desktop app.

Environment

  • Windows package: OpenAI.Codex_26.820.7780.0_x64__2p2nqsd0c76g0
  • App package metadata version: 26.820.60940
  • Build number: 7119
  • Runtime: Owl
  • Electron dependency: 42.3.0
  • OS: Windows 11 x64, version 10.0.26200

The official production update manifest currently also reports 26.820.7780.0 as the stable build.

Steps to reproduce

  1. Open the Windows ChatGPT desktop app.
  2. Open a chat containing a generated image.
  3. Right-click the image.
  4. Select Save Image As….
  5. Choose a destination and let the download complete.

Actual behavior

A modal titled “A JavaScript error occurred in the main process” appears with TypeError: h.setProgressBar is not a function.

Expected behavior

The image should save without a main-process exception.

Root cause found in the shipped bundle

The native image context menu is installed by the app through electron-context-menu (4.1.2), whose bundled download path uses electron-dl.

In the download updated handler, the progress call is guarded only by showProgressBar:

if (!window_.isDestroyed() && options.showProgressBar) {
  window_.setProgressBar(progressDownloadItems());
}

In the download done handler, clearing the progress bar is unconditional whenever no downloads remain:

if (!window_.isDestroyed() && !activeDownloadItems()) {
  window_.setProgressBar(-1);
  receivedBytes = 0;
  completedBytes = 0;
  totalBytes = 0;
}

The Owl-backed window returned by BrowserWindow.fromWebContents(webContents) does not expose setProgressBar, so the completion handler throws.

The app's own installNativeContextMenu prepends the affected saveImageAs action for images, which makes this reproducible from generated-image context menus.

Suggested fix

Either implement BrowserWindow.setProgressBar in the Owl Electron compatibility layer, or capability-check it at both call sites:

if (
  !window_.isDestroyed()
  && typeof window_.setProgressBar === 'function'
  && options.showProgressBar
) {
  window_.setProgressBar(progressDownloadItems());
}

if (!window_.isDestroyed() && !activeDownloadItems()) {
  if (typeof window_.setProgressBar === 'function') {
    window_.setProgressBar(-1);
  }

  receivedBytes = 0;
  completedBytes = 0;
  totalBytes = 0;
}

Workaround

Using the image's in-page download control, or Copy Image followed by saving the clipboard bitmap, avoids the failing native context-menu path.

View original on GitHub ↗

3 Comments

LanMan666 · 1 day ago

Another affected Windows user is seeing the same uncaught main-process exception on Codex build 26.820.7780.0: TypeError: h.setProgressBar is not a function in the DownloadItem handler. It occurred during normal generated-file/image handling and repeatedly interrupted the app. The user's screenshot matches the error dialog and stack trace already documented in this issue. Please treat this as an additional reproduction/impact report.

lucashunter050 · 20 hours ago

Also happens on macOS 26.6.2, ChatGPT.app version 26.820.60940. Trigger is the same: downloading a generated image. The download does not complete and the dialog shows:

Uncaught Exception:
TypeError: h.setProgressBar is not a function
at DownloadItem.<anonymous> (/Applications/ChatGPT.app/Contents/Resources/app.asar/.vite/build/main-BA_G1ClR.js:1678:289166)
at DownloadItem.emit (node:events:520:35)

The download also did not complete, and I had to force quit the application.

Kolomaster68 · 12 hours ago

Reproduces identically on macOS, so this isn't Windows-specific — worth dropping the windows-os-only assumption before a fix ships.

  • App: /Applications/ChatGPT.app, CFBundleIdentifier = com.openai.codex, version 26.820.71523
  • macOS 15 (Darwin 25.5.0), Apple Silicon (arm64)
  • Repro: generate an image in a chat → click the image → Save. The dialog appears ~3x during the download.
Uncaught Exception:
TypeError: h.setProgressBar is not a function
    at DownloadItem.<anonymous> (/Applications/ChatGPT.app/Contents/Resources/app.asar/.vite/build/main-3kQRhaYi.js:1679:289166)
    at DownloadItem.emit (node:events:508:28)

Note the offset is 289166 — the same one quoted in this issue from the Windows build, so both platforms are hitting the same bundled code.

From the shipped app.asar, both call sites in the bundled electron-dl guard with isDestroyed(), which WebContents also implements, and then call a BrowserWindow-only method:

f.on(`updated`, () => { … !h.isDestroyed() && t.showProgressBar && h.setProgressBar(c()) … })
f.on(`done`,    () => { … !h.isDestroyed() && !s() && (h.setProgressBar(-1), …) … })

So h is not a BrowserWindow. Worth flagging that the done handler throws on that line before reaching its completed branch, so onCompleted / reveal-in-Finder never run — the impact is more than the dialog.