VS Code extension crashes with “ReferenceError: process is not defined” in multi-root workspaces

Resolved 💬 5 comments Opened Jul 24, 2026 by xchang1121 Closed Aug 6, 2026
💡 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?

26.5721.30844 (pre-release)

What subscription do you have?

ChatGPT 200 usd Pro subscription

Which IDE are you using?

VS Code 1.130.0 (x64)

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

When I open the Codex sidebar in a VS Code multi-root workspace, the entire sidebar is replaced by the generic error boundary:

Something went wrong

The actual exception captured from the Codex WebView is:

ReferenceError: process is not defined

Object.resolve    app-initial-D5k9IjTG.js:116:74145
Object.relative   app-initial-D5k9IjTG.js:116:74145
                 app-initial-BIdl5ORJ.js:2:8159
Mc               app-initial-BIdl5ORJ.js:2:8088
fln              app-initial-CYUddJaD.js:530:48951

The failing code path filters or compares workspace roots using the bundled path implementation:

Nc.default.posix.relative(Ni(e), Ni(t))

The bundled browser path implementation eventually calls process.cwd(), but the VS Code WebView does not expose the Node.js process global.

This reproduces after clearing both the extension state and the WebView cache, so it does not appear to be caused by stale state, authentication, networking, or regional access.

What steps can reproduce the bug?

  1. Create two folders:
project-a/
project-b/
  1. Create a multi-root workspace file:
{
  "folders": [
    { "path": "project-a" },
    { "path": "project-b" }
  ]
}
  1. Open the .code-workspace file in VS Code.
  2. Open the Codex sidebar.
  3. If necessary, click “Retry” or “New task”.
  4. The sidebar displays the generic error page, and the WebView console reports ReferenceError: process is not defined.

What is the expected behavior?

The Codex sidebar should render the task list and composer normally in a multi-root workspace.

Additional information

As a diagnostic workaround, defining a minimal process object before the WebView application bundle loads prevents the crash:

globalThis.process ??= {
  cwd: () => "/",
  env: {},
  platform: "win32",
  versions: {}
};

After adding this shim locally, clearing the WebView cache, and restarting VS Code:

  • The task list and model selector rendered normally.
  • “New task” worked.
  • The error boundary did not reappear.
  • No Runtime.exceptionThrown or console errors were observed for more than 60 seconds.

This workaround is only evidence for the root cause and is not proposed as the final implementation. Ideally, the workspace-root filtering code should use a WebView-safe path implementation that does not depend on the Node.js process global.

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #35073
  • #35061
  • #35057

Powered by Codex Action

xchang1121 · 1 month ago

For those also sufferring from this:

If you are seeing the generic “Something went wrong” page in the Codex VS Code sidebar while using a multi-root workspace, you may be hitting a WebView compatibility bug rather than an authentication or network problem.

The extension compares your workspace roots using a bundled path.posix.relative() implementation. That implementation eventually calls process.cwd(), but VS Code WebViews do not provide Node.js’s global process object. With multiple workspace roots, this produces:

ReferenceError: process is not defined

You can apply the following temporary workaround:

  1. Completely close every VS Code window.
  1. Find your installed Codex extension directory:
%USERPROFILE%\.vscode\extensions\openai.chatgpt-<version>-win32-x64
  1. Open this file:
webview\index.html
  1. Find the main module entry. It should look similar to:
<script type="module" crossorigin src="./assets/index-<hash>.js"></script>
  1. Open the referenced JavaScript file under webview\assets and make a backup copy.
  1. Add the following code at the very beginning of that file:
// Temporary compatibility shim for the bundled path implementation.
globalThis.process ??= {
  cwd: () => "/",
  env: {},
  platform: "win32",
  versions: {}
};
  1. Clear or move aside the corresponding VS Code WebView CacheStorage directory so that VS Code does not continue serving the old cached bundle.

It will be located somewhere under:

%APPDATA%\Code\WebStorage\<numeric-id>\CacheStorage

The numeric ID is specific to your VS Code profile. Do not blindly delete a particular numbered directory copied from another user. Back up or move the directory instead of permanently deleting it.

  1. Restart VS Code and reopen the Codex sidebar.

After the new bundle is loaded, the sidebar should render normally because process.cwd() is now available to the bundled path implementation.

This is only a local compatibility workaround. Updating or reinstalling the Codex extension will probably overwrite the modified JavaScript file. The proper upstream fix is for the extension to use a browser-safe path implementation that does not depend on Node.js’s global process object.

Selene29 · 1 month ago

Confirmed independently on Windows with extension 26.5721.30844 and VS Code Insiders 1.131.0-insider. The failure was the same unguarded call in app-initial-D5k9IjTG.js:

process.cwd()

Replacing that single call with:

globalThis.process?.cwd?.() ?? "/"

restored the Codex webview after reload.

Polexy · 1 month ago

the beta version works correctly on the same machine and with the same project state.

The issue is reproducible in stable version 26.721.3996.0, but does not reproduce in the current beta build.

The problematic project state contained two rootPaths

The stable build crashed with:
ReferenceError: process is not defined
name=AppRoutes

Please let me know if you need the exact beta version number or additional logs.

retovoegeli · 1 month ago

Independent confirmation on Windows with Codex extension 26.5721.30844.

The Codex panel remains stuck on “Oops, an error has occurred” after:

  • restarting the extension;
  • switching from Release to Pre-Release and back, which reinstalls the extension;
  • restarting VS Code.

This workspace is intentionally multi-root / multi-repository because the development work involves cross-app integrations and shared functions across repositories. Opening only one repository is therefore not a usable workaround: it removes the cross-repository context required for the work and effectively makes the Codex extension unusable.

Please treat this as a blocking regression for real multi-repository development workflows, rather than an optional workspace edge case.