[Windows] Saving a generated image via context menu throws `setProgressBar is not a function`
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
- Open the Windows ChatGPT desktop app.
- Open a chat containing a generated image.
- Right-click the image.
- Select Save Image As….
- 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.
3 Comments
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 functionin theDownloadItemhandler. 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.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.
Reproduces identically on macOS, so this isn't Windows-specific — worth dropping the
windows-os-only assumption before a fix ships./Applications/ChatGPT.app,CFBundleIdentifier = com.openai.codex, version26.820.71523Note 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 bundledelectron-dlguard withisDestroyed(), whichWebContentsalso implements, and then call aBrowserWindow-only method:So
his not aBrowserWindow. Worth flagging that thedonehandler throws on that line before reaching itscompletedbranch, soonCompleted/ reveal-in-Finder never run — the impact is more than the dialog.