Skip to content

[Windows] Codex desktop shows an uncaught MessagePort error #63104

Done

Description

@MCValentin

Description

Codex desktop displayed a JavaScript error dialog in the main process:

Uncaught Exception:
Error: Peer closed MessagePort connection.
    at MessagePortMain.<anonymous>
    at MessagePortMain.emit (node:events:514:20)
    at MessagePortMain._internalPort.emit (node:electron/js2c/browser_init:2:54439)

Reproduction observations

The error does not necessarily appear because of images. It occurs when sending a second or subsequent message in the same chat. Starting a new chat lets me send the information I need in the first message. These are observations, not yet a confirmed root cause or a guaranteed reproduction procedure.

Yesterday I added multiple images without problems. I think the issue may have appeared after the latest update, which I believe was installed last night, but I don't remember the timing exactly. The connection to the update is not confirmed. A similar error is reported in #63011.

Environment

  • Codex desktop package version: 26.1117.4957.0
  • Windows x64

Expected behavior

The application handles a closed connection without showing an uncaught exception dialog.

Additional observed problem

Typing in the Codex desktop input is severely delayed: characters visibly lag individually when typing quickly. It is unknown whether this is related to the MessagePort error.

Activity

  1. added
    bug
    app
    windows-os
    on Nov 22, 2026
  2. github-actions commented on Nov 22, 2026

    @github-actions
    Contributor
  3. fogjoe commented on Nov 22, 2026

    @fogjoe

    I also met this problem and it really affected my work so seriously.

    Error1 Error2
  4. optilun commented on Nov 22, 2026

    @optilun

    Additional affected user on Windows x64, Codex desktop package OpenAI.Codex_26.1117.4957.0_x64__2p2nqsd0c76g0 (visible in the exception dialog).

    Observed dialog:

    A JavaScript error occurred in the main process
    Uncaught Exception:
    Error: Peer closed MessagePort connection.
        at MessagePortMain.<anonymous> (...:45468)
        at MessagePortMain.emit (node:events:514:20)
        at MessagePortMain._internalPort.emit (node:electron/js2c/browser_init:2:54439)
    

    The error persists after uninstalling and reinstalling the Windows desktop app, and prevents reliable Codex desktop use. The exact interaction that triggers it has not yet been established. Screenshot of the dialog is available from the affected user.

    This appears consistent with the same-version MessagePort regression described in this issue. Please investigate and advise whether a fix is planned for an upcoming desktop update.

  5. artemn0va commented on Nov 23, 2026

    @artemn0va

    Another affected user here, reporting on November 23, 2026.

    Environment confirmed from my error dialog: Windows x64, OpenAI.Codex package version 26.1117.4957.0 — the same version as the original report.

    I recently started seeing this error while using Codex. Around the same time, the application became extremely laggy and is now effectively unusable for normal work.

    The error screenshot shows:

    A JavaScript error occurred in the main process
    Uncaught Exception:
    Error: Peer closed MessagePort connection.
        at MessagePortMain.<anonymous>
        at MessagePortMain.emit (node:events:514:20)
        at MessagePortMain._internalPort.emit (node:electron/js2c/browser_init:2:54439)
    

    The first stack entry points into the installed WindowsApps application bundle; the dialog truncates its full location.

    I do not yet have a controlled reproduction or diagnostic logs to share, so I cannot confirm that my trigger matches the second-message/image-attachment cases, that a particular update caused it, or that the lag and MessagePort exception share one cause.

    I am willing to attempt a controlled reproduction and provide the Windows build, exact failure time, relevant desktop logs, a feedback ID, and a short recording. Please let me know which diagnostics would be most useful, and whether there is a supported workaround or a build containing a fix. This is currently blocking normal use of Codex.

  6. fogjoe commented on Nov 23, 2026

    @fogjoe

    i found another way to use codex, installed codex in vscode from Extensions, after login, i can use codex to write code

  7. MCValentin commented on Nov 24, 2026

    @MCValentin
    Author

    Further diagnostic evidence from my Windows installation (sanitized; no conversation contents or identifiers):

    • On 2026-11-22 at 08:20:05 UTC, the desktop host logged Failed to execute queued message and Failed to release queued message send lock, both with RangeError: Message exceeds the 536870912-byte serialization limit. The stack passes through MessagePortMain.postMessageWithSizeLimit and updateQueuedFollowUps. At 08:20:33 UTC in the corresponding desktop session, a composer submit failed with Peer closed MessagePort connection. The same serialization error also appeared in other sessions that morning.
    • Read-only inspection on November 24 found the active .codex-global-state.sqlite global / queued-follow-ups value is 482,226,745 bytes (~459.9 MiB): one pending queued item for one thread, including 27 image attachments occupying approximately 482,221,684 serialized bytes. Its thread identifier matches the queued-message failure at 08:20:05. I did not open that conversation or expose its contents. The legacy JSON state is also ~460 MiB.
    • The original failure was on Windows package 26.1117.4957.0. Composer Peer closed MessagePort connection failures also appear on November 24 after updating to package 26.1120.5083.0 (app About version 26.1120.41243, build 30607). The app update checker currently says up to date.

    This is strong evidence of an oversized queued-follow-up serialization failure in at least one incident, but the logs do not prove that every later MessagePort failure has the same cause, or explain why the attachments remained queued. A similar oversized image-queue/performance report is #53427. Please investigate bounding or externalizing image payloads, recovering from oversized messages without closing the shared port, and retaining/recovering unsent content safely.

    A targeted removal of the oversized queue item after backing it up and fully exiting all writers is a candidate workaround; I have not yet applied or validated it, so I cannot claim it fixes the crash.

  8. MCValentin commented on Nov 24, 2026

    @MCValentin
    Author

    Workaround follow-up: after fully exiting Codex desktop, I made and verified a private backup of .codex-global-state.sqlite, then removed only the identified oversized pending queued-follow-up entry from the active SQLite global state. No conversation histories were deleted. A post-change PRAGMA quick_check returned ok; the active queued-follow-ups value was 2 bytes ({}). The backup retains the pending entry and its attachments.

    After restarting the desktop app, two short test messages submitted to this same chat arrived successfully. This is an encouraging initial result, not proof of a permanent fix or that every MessagePort failure has the same cause. Longer-term use and additional follow-ups still need testing. If attempting a similar intervention, preserve the original data and fully stop all writers first; pending messages removed from the active queue will not automatically be sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugperformancewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions