Skip to content

ChatGPT hit a snag bug reproduce #44720

Closed

Description

@cch123

What version of the Codex App are you using (From “About Codex” dialog)?

26.908.31457

What subscription do you have?

20x pro

What platform is your computer?

mac os

What issue are you seeing?

Image codex starting with error

What steps can reproduce the bug?

Codex 26.908.31457: circular module dependency causes startup and pet-window errors

Summary

A circular dependency in the shipped frontend bundle causes an initializer to be called before it has been assigned, depending on module evaluation order. The error was reproduced using code extracted from the installed application in a separate Chromium instance. Breaking the dependency cycle allowed all five tested entry and prefetch scenarios to complete successfully.

The visible symptom is the “ChatGPT hit a snag” recovery screen during startup. The user also reports the same screen in the pet window after selecting “Show pet.” The failure can occur outside Electron, so the application’s frontend module dependency graph is sufficient to explain this error.

Environment and investigation scope

  • Application version: 26.908.31457, build 8690.
  • The two application bundle copies, in Applications and Downloads, have identical app.asar files.
  • app.asar SHA-256: a10aceafa8d904999e0226344896bc7346e16ef0333d0694bbf1d950ad4105a8.
  • Reproduction engine: isolated Chromium 145.0.7632.6.
  • Minimal ECMAScript module (ESM) experiments: Node.js 24.20.0.
  • The installed application bundle was inspected without modification. The running application was neither restarted nor modified during this investigation. The experimental patch was applied only by substituting resource responses in the isolated browser.
  • Each browser scenario used a fresh temporary context. Page requests to external hosts were blocked, and application resources were served from locally extracted files.

Exact failure location

TypeError: r is not a function
    at authed-route-70c1c8333037.js:1:1573

This matches the message recorded in the desktop logs for Initial route prefetch failed and the AppRoutes error boundary. The desktop logs contained only a simplified Error; the isolated reproduction captured the original TypeError and its file location.

Dependency cycle

app-primary-1e3e98d65d25.js
  └─ statically imports n / t from authed-route to obtain a smartphone icon
       └─ authed-route imports kc from app-primary and calls it as r() at module scope
            └─ kc refers to var uzn in app-primary, which has not yet been assigned

The relevant relationships in the bundled code are shown below. These are shortened excerpts from separate modules, not a standalone script:

// app-primary: imports a shared icon from the route module.
import { n as mZe, t as hZe } from './authed-route-70c1c8333037.js';

// authed-route: imports an initializer from app-primary and calls it at module scope.
import { Dc as t, Oc as n, kc as r } from './app-primary-1e3e98d65d25.js';
// ...icon definition...
r();

// app-primary: assigns the bundler-generated initializer later during evaluation.
var uzn = t(() => { /* ... */ });
export { uzn as kc };

When evaluation begins through app-primary, its dependency authed-route executes before the assignment to uzn has run. The var binding is therefore still undefined, and the top-level r() call throws a TypeError.

Loading authed-route first and then loading HomeComposerRoute succeeds in the isolated reproduction.

Bundle coordinates for source mapping or further investigation (line:column):

  • app-primary-1e3e98d65d25.js:2:44341: imports the icon from the route module.
  • app-primary-1e3e98d65d25.js:1114:611796: assigns the uzn initializer.
  • authed-route-70c1c8333037.js:1:1573: the call that throws.

Why startup can trigger the failure intermittently

The startup prefetch function, o8a, prefetches AuthedRoute and HomeComposerRoute concurrently. With descriptive names substituted for the minified variables, its behavior is:

await Promise.all([
  AuthedRoute.prefetch(),
  HomeComposerRoute.prefetch(),
]);

HomeComposerRoute imports app-primary directly.

The shipped preload helper records a shared CSS URL before its stylesheet finishes loading. The first prefetch waits for that stylesheet’s load event. A subsequent prefetch sees that the URL has already been recorded and continues without waiting for the same stylesheet. This can allow the later HomeComposerRoute request to enter module evaluation first.

An experiment using the application’s original preload helper and a minimal version of the dependency cycle produced the following results:

Shared stylesheet state Dynamic import order Result
A new stylesheet link must be created Home → Authed Both requests fail with r is not a function
A stylesheet link already exists Authed → Home Both requests succeed

This verifies a concrete mechanism that can change the evaluation order. Resource timing was not captured for every failure in the running desktop application, so this does not establish that every observed failure was triggered by the same CSS timing sequence.

Why “Show pet” can trigger the same error

Importing the pet module itself succeeds. However, its shared page container also mounts WorkspaceSettingsWebviewHost:

Shared container used by the pet window
  → WorkspaceSettingsWebviewHost
  → webview-page-f5e8f4c88b2c.js
  → app-primary
  → authed-route’s top-level r() call

The lazy host is mounted unconditionally by that shared container in app-initial. The webview-page module statically imports app-primary.

In the isolated browser, importing the pet module and then the host module reproduced the same error at the same location. This supports the dependency chain identified through static inspection; it is not a full interaction test of the production pet window.

Original bundle versus isolated experimental fix

The experimental fix made only two changes:

  1. Extract the smartphone icon into a separate module.
  2. Change the icon import in app-primary to reference that new module.

The route logic was left unchanged.

Scenario Original bundle After extracting the icon module
Import app-primary directly Same TypeError Success
Import HomeComposerRoute directly Same TypeError Success
Import pet, then WorkspaceSettingsWebviewHost Same TypeError Success
Call the original concurrent startup prefetch function Same TypeError Success
Call the original prefetch function with CSS responses delayed by 100 ms Same TypeError Success

To invoke the otherwise unexported startup prefetch function from the test page, test exports were appended to the response for the extracted module. The function bodies were not modified.

Recorded browser results are included in evidence.json. The patch description and hashes are in fix-manifest.json.

Minimal reproduction

From the accompanying minimal-repro directory, run:

node run.js authed-route
node run.js home-composer-route
node concurrent.js cold
node concurrent.js warm

Expected results, in order:

  1. Success.
  2. TypeError: r is not a function.
  3. Both concurrent requests fail with the same error.
  4. Both concurrent requests succeed.

This reduced example preserves the dependency cycle and the var initialization order. It is separate from the full-bundle Chromium experiments described above. The concurrency example uses the preload helper extracted from the installed application and a small simulated DOM for stylesheet loading.

Suggested fix and validation limits

Remove the reverse dependency from the primary application module to the route module. Shared icons should be defined in an independent module rather than exported from a route module that depends on the primary application module.

Regression coverage should exercise the bundled output through the direct primary entry, concurrent startup prefetch, and the shared host used by the pet window.

No verified config.toml workaround was found. Clearing caches does not remove the dependency cycle.

The isolated patch eliminated the TypeError in the tested import and prefetch scenarios. It has not been installed into the production application, and complete desktop functionality has not been regression-tested. These results should not be interpreted as a claim that the user’s running client has already been fixed.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on Sep 11, 2026
  2. added
    bug
    on Sep 11, 2026
  3. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  4. cch123 commented on Sep 11, 2026

    @cch123
    Author
  5. suiyun08 commented on Sep 11, 2026

    @suiyun08

    遇到一样的问题

  6. apmson commented on Sep 11, 2026

    @apmson

    same here

  7. singularitti commented on Sep 11, 2026

    @singularitti

    Same here. Nothing changes but I got a crash after upgrade.

  8. singularitti commented on Sep 11, 2026

    @singularitti

    One more annoying thing: If I have a pet, it will create a window that shows "ChatGPT hit a snag", covering half of the screen on the monitor where I choose to show the pet.

    Image

    The position of this window is completely random, depending on where I put my pet last time. I have to tuck away my pet to hide the annoyance.

  9. ardaerturk commented on Sep 11, 2026

    @ardaerturk

    Linux DEB confirmation

    I independently verified the same circular dependency in the official Ubuntu AMD64 package.

    Environment

    • Ubuntu 24.04 x86_64 (Linux 6.17.0-1022-azure)
    • Broken: chatgpt 26.908.31748
    • Working control: chatgpt 26.901.51231
    • Broken DEB SHA-256: 2df54c70c7c86042e1b525fb123188e9fcd1e7993e4a77ed0e93f250b2d80685

    Broken bundle (26.908.31748)

    authed-route-ea4dff16d149.js -> app-primary-40179637950b.js
    app-primary-40179637950b.js -> authed-route-ea4dff16d149.js
    

    authed-route executes n() at module scope immediately before its export. The Sentry breadcrumb records the corresponding failure:

    TypeError: n is not a function
    at app://-/assets/authed-route-ea4dff16d149.js:1:1573
    

    Working control (26.901.51231)

    authed-route-c6c5ea468cc3.js -> app-primary-bd4b894ed032.js
    

    The working app-primary does not import authed-route, so the reverse edge and cycle are absent.

    Upgrade to 26.908.31748 produced the recovery screen; rollback to 26.901.51231 restored the same profile and configuration. Reinstalling 26.908.31748 reproduced the failure, and rolling back again restored operation.

    This confirms the dependency-cycle regression in the Linux AMD64 bundle as well. The minified failing identifier is n on Linux rather than r.

  10. SssCool commented on Sep 11, 2026

    @SssCool

    I can confirm this issue is still reproducible on ChatGPT/Codex macOS build 26.908.31748 (Apple Silicon, macOS 26.6.2).

    The app often launches successfully after a full macOS restart, but after Quit → relaunch, it frequently shows “ChatGPT hit a snag.”

    Sentry consistently reports:
    TypeError: r is not a function
    at app://-/assets/authed-route-86740a2af5a2.js:1:1573
    under the AppRoutes error boundary.

    I also see Initial route prefetch failed; rendering will retry errorMessage="r is not a function".

    Clean reinstall, clearing local ChatGPT/Codex state, switching networks, and launching with --disable-gpu did not resolve it. Backend/API requests are returning HTTP 200 normally.

    So the same failure appears to persist in 26.908.31748, not only 26.908.31457.

  11. ragtimelab commented on Sep 11, 2026

    @ragtimelab

    Deterministic macOS Intel Pet/avatarOverlay reproduction

    Additional evidence for the Pet-specific path, reproduced on an Intel Mac.

    Environment

    • ChatGPT/Codex Desktop: 26.908.31457
    • Build: 8690
    • Bundle ID: com.openai.codex
    • macOS: 15.8 (24H22)
    • Architecture: Intel x86_64
    • Selected Pet: Null Signal

    Observed A/B sequence

    1. With the Pet awake, Settings → Pets showed Tuck Away Pet, and a separate oversized “ChatGPT hit a snag” window was visible at the Pet position.
    2. After tucking away the Pet, Settings → Pets showed Wake Pet, and the error window disappeared immediately while the main ChatGPT/Codex window remained usable.
    3. The attached screenshots were taken 12 seconds apart (17:32:45 and 17:32:57 KST) and show the two states directly.

    The user also observed that rebooting macOS and relaunching ChatGPT did not clear the Pet-associated error while the Pet remained enabled. Fully quitting ChatGPT removed the window, and tucking away the Pet removed it without quitting the main application.

    The matching local renderer signature is:

    TypeError: r is not a function
    at app://-/assets/authed-route-70c1c8333037.js:1:1573
    name=AppRoutes
    rendererWindowAppearance=avatarOverlay
    rendererWindowVisible=true
    

    This extends the existing Apple Silicon reports with an Intel x86_64 reproduction and supports the Pet/shared-container path described in this issue. Related macOS report: #44687.

    The separately observed custom Pet shortcut no-op predates discovery of this renderer failure and will be reported separately rather than asserted as the same cause.

    Image Image
  12. HenryC-3 commented on Sep 11, 2026

    @HenryC-3

    Confirming this on 26.908.31748 (build 8720), macOS 15.4.1 — same failure, same stack.

    Symptoms

    [electron-message-handler] Initial route prefetch failed; rendering will retry
      errorMessage="r is not a function" route=primary windowType=electron
    [renderer console] Matched leaf route at location "/" does not have an element or Component
    [electron-message-handler] error boundary name=AppRoutes
      errorMessage="r is not a function" componentStack="at Lazy → at Suspense → ..."
    

    "Try again" never recovers it. Quitting and relaunching reproduced it ~6 times in a row, then a later launch started fine — consistent with OP's analysis that this is a module load-order race, not fixed corruption. So reinstalling the same version doesn't fix anything; you're just re-rolling the dice.

    The error only goes to stdout, so to capture it yourself:

    /Applications/ChatGPT.app/Contents/MacOS/ChatGPT 2>&1 | tee /tmp/chatgpt.log

    What I ruled out (so you don't waste time)

    Suspect Result How
    Backend / app-server Healthy JSON-RPC initialize against the bundled codex app-server responds normally
    Corrupt install No codesign --verify → valid on disk
    Chromium caches No Deleted Cache, Code Cache, GPUCache — identical failure
    ~/.codex/config.toml No Moved the whole file aside — identical failure
    Outdated app No Sparkle check reported no newer version available
    Native crash No No Crashpad / DiagnosticReports entries

    Decisive test — an empty CODEX_HOME + fresh Chromium profile, only auth.json copied in:

    mkdir -p /tmp/probe/home /tmp/probe/ud
    cp ~/.codex/auth.json /tmp/probe/home/
    CODEX_HOME=/tmp/probe/home /Applications/ChatGPT.app/Contents/MacOS/ChatGPT --user-data-dir=/tmp/probe/ud

    Zero user data, same crash. Nothing in your local state causes this — don't delete your config.

    ⚠️ Side effect worth knowing: it silently wipes your project list

    While the app is in the crashed state, the renderer writes a default state back to disk on startup. My ~/.codex/.codex-global-state.json went from 1.18 MB / 47 keys → 1.9 KB / 15 keys, and .codex-global-state.json.bak was overwritten with the same truncated content in the same pass. local-projects became {}.

    Lost: project list, pinned threads, sidebar order, thread→project assignments, prompt history, window layout.

    If you hit this screen, back up before restarting the app again:

    cp ~/.codex/.codex-global-state.json ~/codex-state-backup.json

    This matches the "wiped projects" reports on the community forum, so it may not be specific to this crash.

    Your conversations are NOT lost

    The empty sidebar makes it look like they are. All thread data lives elsewhere and is untouched:

    • ~/.codex/sessions/**/*.jsonl — raw rollouts
    • ~/.codex/thread_history_1.sqlite

    In my case 752 threads / 129,942 items / 3.6 GB, fully intact. Once the app starts, Cmd+K finds all of them.

    Rebuilding the project sidebar

    Two useful facts: config.toml still lists every project path you ever trusted ([projects."/path"]), and each thread still carries its project assignment — so re-adding a project makes its threads reappear under it automatically.

    Quit the app first (it overwrites this file on exit), then:

    import json, uuid, time, os
    P = os.path.expanduser("~/.codex/.codex-global-state.json")
    d = json.load(open(P))
    lp, order = d.setdefault("local-projects", {}), d.setdefault("project-order", [])
    now = int(time.time() * 1000)
    for path in ["/absolute/path/to/project-a", "/absolute/path/to/project-b"]:
        pid = str(uuid.uuid4())
        lp[pid] = {"id": pid, "name": os.path.basename(path), "rootPaths": [path],
                   "createdAt": now, "updatedAt": now}
        order.append(pid)
    json.dump(d, open(P, "w"), ensure_ascii=False)

    On the next launch the app registers each project with the app-server on its own (app-server-project-id-by-legacy-project-id-by-host fills in) and threads re-attach. I restored 11 projects this way with no further work.

    To decide which projects are still worth restoring: the first line of each rollout .jsonl contains cwd and a timestamp, so you can rank paths by last activity.

  13. ElierHG commented on Sep 11, 2026

    @ElierHG

    Windows confirmation - build 26.908.3777.0

    I reproduced the same visible startup failure after the Microsoft Store update:

    • Codex App / ChatGPT package: 26.908.3777.0 (OpenAI.Codex)
    • Platform: Microsoft Windows NT 10.0.26200.0 x64 (Windows 11 25H2, build 26200.9445)
    • Symptom: the main window showed "ChatGPT hit a snag - Something went wrong. Try again to continue", with Try again and Update ChatGPT buttons.
    • Try again did not recover the window.
    • Microsoft Store reported 26.908.3777.0 as the latest version, so Update ChatGPT had no newer package to install.
    • Windows reported the AppX package status as Ok; the process remained responsive and no matching Application Error event was recorded.

    A one-time recovery succeeded after fully stopping the app, moving these Chromium/Electron renderer caches aside, and relaunching:

    • GPUPersistentCache
    • GrShaderCache
    • ShaderCache
    • Default/Cache
    • Default/Code Cache
    • Default/DawnGraphiteCache
    • Default/DawnWebGPUCache
    • Default/GPUCache

    The app rebuilt the folders and opened normally. This may only have changed module timing and re-rolled the race described in the issue; it should not be treated as proof that cache corruption is the root cause or as a permanent fix.

  14. v301eu commented on Sep 11, 2026

    @v301eu
    Image

    Powered by Codex & OWL
    Version 26.908.31457
    Released 11 Sept 2026

  15. 13 remaining items

  16. yuzhu-oai commented on Sep 11, 2026

    @yuzhu-oai
    Contributor

    Fixed. Please update to the latest version.

  17. cezarykramp-gif commented on Sep 11, 2026

    @cezarykramp-gif

    Additional Linux confirmation for the affected 26.908.40401 package (observations made before the fix announcement above). The newly announced release has not yet been tested on this installation.

    Environment: official ChatGPT Debian package, amd64, Ubuntu 24.04.4 LTS, XFCE 4.18, TigerVNC 1.13.1 / X11 on a VPS, ordinary non-root desktop user. Package integrity verification was clean.

    Observed behavior: initial sign-in succeeded; quitting and relaunching intermittently displayed “ChatGPT hit a snag” with TypeError: n is not a function, despite successful account lookup. A separate interface profile also failed after restart (same HOME, Codex home and keyring, so not complete identity isolation). A later launch displayed the interface while the startup journal still contained the TypeError.

    Read-only inspection of the installed app.asar at 2026-09-11 19:51 UTC confirms:

    • app-primary-124c64e4a755.js imports n as yZe,t as bZe from authed-route-95b7e7dbb938.js.
    • authed-route defines/exports the smartphone icon and initializer, imports jc as n from app-primary, and invokes n() at module scope.
    • app-primary exports nzn as jc, with nzn assigned by var tzn,D1,nzn=t((()=>{...})).

    This independently confirms the matching static dependency cycle; we did not reproduce the precise CSS timing or test a bundle patch. The installed bundle, credentials and original profile were preserved. No raw logs, account identifiers or private project data are attached.

    Thank you for announcing the fix. Which exact Linux Debian package version first includes it?

  18. zulroxx commented on Sep 11, 2026

    @zulroxx

    Fixed. Please update to the latest version.

    Image still sir
  19. saigyujikingyo-png commented on Sep 11, 2026

    @saigyujikingyo-png

    Additional Windows 11 x64 reproduction and official Store fallback comparison for this issue, observed on 11 September 2026.

    • Windows 11 Home, build 26200.
    • Installed package: OpenAI.Codex 26.908.4561.0.
    • Embedded desktop version: 26.908.40401, build 8837.
    • User-visible failure: “ChatGPT 遇到了问题” with Retry / Update ChatGPT, often after relaunch. Repair/reinstall has not reliably resolved it.
    • Renderer signature: r is not a function under AppRoutes.

    Controlled observations with original executable/resources:

    Package / isolated input Outcome
    26.908.4561.0, clean home and browser profile with current sign-in only Fatal error page
    26.908.4561.0, second independent clean home/profile Fatal error page
    26.908.4561.0, recovered-state copy Started successfully
    Official Store 26.903.9818.0, two clean profiles Both started successfully
    Official Store 26.903.9818.0, recovered-state copy Started successfully
    Official Store 26.903.9818.0, current databases/UI preferences copied for testing Started successfully

    The diagnostic observer did not override assets, modules, relaunch behavior, or the bundled backend. Successful windows were observed for about 18 seconds; these are startup results, not a long-term reliability guarantee. The older candidate was tested from extracted, unchanged Store package files before package registration. WinGet hash verification and Windows Authenticode verification passed.

    The older bundled 0.153.4 backend also read all 13 local projects and sampled full conversation histories from all 11 populated projects, preserving thread IDs and project associations in isolated compatibility tests. This supports a native package fallback without deleting conversation data.

    Static inspection of this Windows build shows the matching reverse import:
    app-primary-c24bccad67ce.js → authed-route-bccf47ed0783.js → primary initialization.
    The reverse route import is absent in the older app-primary-4c40d73a1074.js. This is consistent with the reported cycle; precise scheduling of every production failure was not captured.

    Windows availability after the fix announcement: at approximately 20:18 UTC / 21:18 BST, the public Windows Store update manifest at https://persistent.oaistatic.com/codex-app-prod/windows-store-update.json still reported 26.908.4561.0. A fresh WinGet Store download for x64 / Windows.Desktop / OS 10.0.26200.0 still supplied 26.903.9818.0. We have not obtained or tested a newer fixed Windows package.

    Which exact Windows MSIX version first contains the fix, and when should it be available through the native Store updater? The user considers this a severe reliability issue and wants a permanent signed native fix. Native shortcut activation was separately corrected and tested; it does not resolve this renderer failure.

    Report prepared with an assistant from local diagnostics at the user's explicit request. No credentials, account identifiers, personal paths, raw logs, or conversation contents are attached.

  20. singularitti commented on Sep 11, 2026

    @singularitti

    The pet problem seems to be fixed for me on 26.908.40834.

  21. xBrasil commented on Sep 11, 2026

    @xBrasil

    Still happening for me (Windows 11) on latest version as of today (september 11 2026)

  22. a3ro-dev commented on Sep 12, 2026

    @a3ro-dev

    how to fix this </3

  23. rnagabhyrava commented on Sep 12, 2026

    @rnagabhyrava

    same issue on linux (ubuntu)

  24. thaccc100-beep commented on Sep 14, 2026

    @thaccc100-beep

    its still happening windows 11

  25. cch123 commented on Sep 14, 2026

    @cch123
    Author

    its still happening windows 11

    let your codex cli help you find out the root cause

  26. yuzhu-oai commented on Sep 14, 2026

    @yuzhu-oai
    Contributor

    Please update to the latest version. It has been fixed. Thanks!

  27. a3ro-dev commented on Sep 15, 2026

    @a3ro-dev

    pack it up </3

  28. 0sean commented on Nov 9, 2026

    @0sean

    Fixed for me by updating Codex CLI, not just the app

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

    appbugpets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions