VS Code Webview fails to load because the ChatGPT extension preloads up to 676 JS/CSS assets concurrently
Open 💬 4 comments Opened Jul 19, 2026 by YYH2913
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the IDE extension are you using?
openai.chatgpt-26.715.31925
What subscription do you have?
pro
Which IDE are you using?
VS Code
What platform is your computer?
Linux 7.0.0-28-generic x86_64 x86_64
What issue are you seeing?
The Webview may fail to initialize and show one or more of the following symptoms:
- The loading animation never completes
- Blank or gray Webview
- JavaScript or CSS preload failures
- Service Worker registration failure
- Local Webview resources fail with
net::ERR_FAILED
The developer console may also contain errors or warnings similar to:
potential listener LEAK
net::ERR_FAILED
CSS/JS preload failed
Service Worker registration failed because the document state became invalid
What steps can reproduce the bug?
- Install or update the OpenAI ChatGPT/Codex VS Code extension to version
openai.chatgpt-26.715.31925. - Open the ChatGPT/Codex Webview from the VS Code sidebar.
- Open the Webview developer tools:
- Run
Developer: Open Webview Developer Toolsfrom the Command Palette. - Select the ChatGPT/Codex Webview if prompted.
- Reload the Webview or restart VS Code.
- Observe that the generated Vite entry point attempts to preload approximately 676 JavaScript and CSS resources at once.
- In affected environments, the Webview remains on the loading animation or becomes blank or gray.
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This issue was identified and resolved by gpt5.6-sol. The solution works well across multiple versions. Below is the report and proposed fix provided by gpt5.6-sol.
Summary
In version
openai.chatgpt-26.715.31925, the VS Code extension Webview entry point may attempt to preload up to 676 JavaScript and CSS resources in a single batch.Because VS Code Webviews rely on a Service Worker to serve local extension resources, the large number of concurrent
modulepreloadrequests can overwhelm or invalidate the Webview loading process.This can cause the Codex/ChatGPT Webview to remain stuck on the loading animation or display a blank, gray, or otherwise unresponsive screen.
Affected version
openai.chatgpt-26.715.31925Observed behavior
The Webview may fail to initialize and show one or more of the following symptoms:
net::ERR_FAILEDThe developer console may also contain errors or warnings similar to:
Root cause
The generated Webview entry point invokes the preload helper with a very large dependency list.
The helper in:
creates preload elements for both CSS files and JavaScript modules. In the affected build, this results in hundreds of concurrent JavaScript
modulepreloadrequests in addition to the CSS requests.VS Code Webview resources are served through a Service Worker. Issuing several hundred local resource requests concurrently appears to cause request failures, excessive event listeners, or invalidation of the document state during Service Worker registration.
As a result, one or more required frontend modules fail to load and the application never finishes bootstrapping.
Working fix
1. Restrict the preload helper to CSS files
Modify
preload-helper-D1M5K2pS.jsso that the preload dependency list only contains CSS resources:This prevents the helper from creating hundreds of JavaScript
modulepreloadelements.2. Bundle the JavaScript module graph
Use
esbuildto bundle the complete JavaScript module graph into a single entry file:Generated bundle size:
3. Update the Webview entry point
Modify the Webview
index.htmlso that its main script points directly to the bundled file instead of the original multi-module entry point.Conceptually:
After these changes, the Webview loads successfully because:
Expected behavior
The extension Webview should load reliably without generating hundreds of concurrent
modulepreloadrequests.The production build should either:
modulepreloadtags for the entire JavaScript dependency graph, orSuggested upstream fix
Please adjust the extension build or runtime preload logic so that JavaScript dependencies are not all preloaded concurrently.
A minimal mitigation would be to preload CSS only:
A more robust solution would be to configure the production build to emit a limited number of JavaScript chunks, or a single Webview-compatible bundle, rather than relying on hundreds of module requests.
Additional notes
This appears to be specific to the interaction between Vite-generated module preload behavior and the VS Code Webview resource-loading architecture. The same asset graph may work in a normal browser environment but fail inside a Webview because local extension resources are mediated by the Webview Service Worker.
I encountered the same Codex Webview error on Fedora:
Reloading VS Code, reloading the Webview, and installing an earlier
26.715.xextension version did not help.I then uninstalled the Codex extension, completely closed VS Code, and cleared the VS Code Webview/cache directories:
After reopening VS Code, I reinstalled the latest Codex extension. The Codex Webview then loaded normally again.
Environment:
This appears to be a workaround involving a clean extension reinstall together with clearing the VS Code Webview/service-worker cache, rather than a fix for the underlying issue.
I had this problem. I asked Codex CLI to apply the fixes from this issue and it's now working fine.