VS Code Codex send fails when persisted prompt-history is not an array

Open 💬 3 comments Opened May 7, 2026 by dkx2077

What version of the IDE extension are you using?

openai.chatgpt 26.429.30905

What subscription do you have?

ChatGPT Pro

Which IDE are you using?

VS Code on macOS, connected to Ubuntu via Remote SSH

What platform is your computer?

Darwin 25.3.0 arm64 arm

What issue are you seeing?

The Codex VS Code extension send action fails before the request is sent.

When I type a prompt such as 123 and click Send, or press Enter, the UI appears to do nothing. The
Codex Webview DevTools console shows:

```text
composer-DCiWkR6u.js:119 Uncaught (in promise) TypeError: n is not iterable
at u (composer-DCiWkR6u.js:119:45357)
at ns (composer-DCiWkR6u.js:220:12188)
at onSubmit (composer-DCiWkR6u.js:220:18850)
at use-model-settings-DI3cK46E.js:1942:39621
at Set.forEach (<anonymous>)
at hve.emit (use-model-settings-DI3cK46E.js:1942:39610)
at Enter (use-model-settings-DI3cK46E.js:1942:40807)

I also saw telemetry/network errors like Sentry 429 Too Many Requests and Statsig 403 Forbidden, but
those appear secondary. The blocking error is TypeError: n is not iterable.

Root cause hypothesis: the composer submit path appends the submitted prompt to persisted prompt history
before sending the request. The compiled Webview bundle contains logic equivalent to:

let t = [...n, e]

If the persisted prompt-history value is not an array, this throws before the actual submit request is
sent. That makes the Send button appear unresponsive.

What steps can reproduce the bug?

  1. Install and open the Codex VS Code extension.
  2. Use VS Code on macOS connected to an Ubuntu machine via Remote SSH.
  3. Open the Codex Webview Developer Tools.
  4. In the Codex Webview frame, simulate invalid persisted prompt history:

``js
localStorage.setItem(
"codex:persisted-atom:prompt-history",
JSON.stringify({ invalid: true })
);
location.reload();
``

  1. Type a prompt, for example:

``
123
``

  1. Click Send or press Enter.

Actual result: the Webview console throws:

TypeError: n is not iterable

The request is not sent.

What is the expected behavior?

Invalid or corrupted persisted prompt history should not prevent message submission.

The extension should either ignore/reset invalid prompt-history state or normalize it before use. For
example:

``js
const history = Array.isArray(promptHistory) ? promptHistory : [];
const nextHistory = [...history, prompt];
``
Clicking Send or pressing Enter should still send the prompt even if persisted prompt history is
malformed.

Additional information

Remote server platform:

``text
Linux 6.8.0-101-generic x86_64 x86_64
`
Remote extension path:
`
~/.vscode-server/extensions/openai.chatgpt-26.429.30905-linux-x64
``
I verified a local workaround by patching the compiled Webview bundle:

  • let t = [...n, e]
  • let t = [...(Array.isArray(n) ? n : []), e]

After reloading VS Code, sending worked again.

This was only a local workaround and will be overwritten by extension updates or reinstalls. The
suggested upstream fix is to validate/migrate persisted prompt-history so non-array values are reset to
[].

I also saw this warning in the logs:

PendingMigrationError: navigator is now a global in nodejs

but the specific send failure was resolved by guarding the prompt history array usage.

View original on GitHub ↗

3 Comments

jpq20 · 3 months ago

same issue here, how can we solve this bug?

tolgahayit · 3 months ago

I can confirm this exact issue on my setup as well.

Environment:

Remote OS: Ubuntu
VS Code: Remote SSH
Extension: openai.chatgpt 26.429.30905
Remote extension path:
~/.vscode-server/extensions/openai.chatgpt-26.429.30905-linux-x64

Symptoms:

  • Typing a text prompt and pressing Enter or clicking Send did nothing.
  • Adding an image/context appeared to work differently, but plain text submission failed.
  • The Codex Webview DevTools console showed:
composer-DCiWkR6u.js:119 Uncaught (in promise) TypeError: n is not iterable
    at u (composer-DCiWkR6u.js:119:45357)
    at ns (composer-DCiWkR6u.js:220:12188)
    at onSubmit (composer-DCiWkR6u.js:220:18850)

I tried the following first, but they did not resolve the submit failure in my case:

  • signing out and signing back in
  • clearing/recreating ~/.codex
  • reinstalling the extension
  • removing/recreating ~/.vscode-server
  • checking Webview localStorage, sessionStorage, and indexedDB; all were empty
  • setting extensions.supportNodeGlobalNavigator=true, which fixed the separate "navigator is now a global in nodejs" warning, but not the composer submit failure

The workaround that fixed it was patching the compiled webview bundle on the remote host.

First, I backed up the file:

cp ~/.vscode-server/extensions/openai.chatgpt-26.429.30905-linux-x64/webview/assets/composer-DCiWkR6u.js \
   ~/.vscode-server/extensions/openai.chatgpt-26.429.30905-linux-x64/webview/assets/composer-DCiWkR6u.js.bak

Then I replaced this:

let t=[...n,e]

with this:

let t=[...(Array.isArray(n)?n:[]),e]

I used this one-off patch command:

python3 - <<'PY'
from pathlib import Path

p = Path.home() / ".vscode-server/extensions/openai.chatgpt-26.429.30905-linux-x64/webview/assets/composer-DCiWkR6u.js"

s = p.read_text()

old = "let t=[...n,e]"
new = "let t=[...(Array.isArray(n)?n:[]),e]"

count = s.count(old)
print("matches before:", count)

if count != 1:
    raise SystemExit(f"Expected exactly 1 match, found {count}; not patching.")

s = s.replace(old, new, 1)
p.write_text(s)

print("patched:", p)
print("matches after old:", s.count(old))
print("matches after new:", s.count(new))
PY

After Developer: Reload Window, text submission started working again.

This is only a local workaround and will probably be overwritten by extension updates or reinstalling the extension. But it confirms that the submit path should guard this value before spreading it, for example:

const history = Array.isArray(promptHistory) ? promptHistory : [];
const nextHistory = [...history, prompt];

So the upstream fix seems to be validating/migrating the prompt history value before using it in the composer submit path.

donaldm · 3 months ago

I am seeing the same issue