Repository navigation
Description
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?
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.asarfiles. app.asarSHA-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 theuzninitializer.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:
- Extract the smartphone icon into a separate module.
- Change the icon import in
app-primaryto 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 warmExpected results, in order:
- Success.
TypeError: r is not a function.- Both concurrent requests fail with the same error.
- 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
github-actions commentedon Sep 11, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
cch123 commentedon Sep 11, 2026
https://github.com/cch123/codex-bug-repro
minimal reproduce demo
suiyun08 commentedon Sep 11, 2026
遇到一样的问题
apmson commentedon Sep 11, 2026
same here
singularitti commentedon Sep 11, 2026
Same here. Nothing changes but I got a crash after upgrade.
singularitti commentedon Sep 11, 2026
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.
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.
ardaerturk commentedon Sep 11, 2026
Linux DEB confirmation
I independently verified the same circular dependency in the official Ubuntu AMD64 package.
Environment
Linux 6.17.0-1022-azure)chatgpt 26.908.31748chatgpt 26.901.512312df54c70c7c86042e1b525fb123188e9fcd1e7993e4a77ed0e93f250b2d80685Broken bundle (
26.908.31748)authed-routeexecutesn()at module scope immediately before its export. The Sentry breadcrumb records the corresponding failure:Working control (
26.901.51231)The working
app-primarydoes not importauthed-route, so the reverse edge and cycle are absent.Upgrade to
26.908.31748produced the recovery screen; rollback to26.901.51231restored the same profile and configuration. Reinstalling26.908.31748reproduced 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
non Linux rather thanr.SssCool commentedon Sep 11, 2026
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.
ragtimelab commentedon Sep 11, 2026
Deterministic macOS Intel Pet/avatarOverlay reproduction
Additional evidence for the Pet-specific path, reproduced on an Intel Mac.
Environment
26.908.314578690com.openai.codex15.8(24H22)x86_64Observed A/B sequence
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:
This extends the existing Apple Silicon reports with an Intel
x86_64reproduction 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.
HenryC-3 commentedon Sep 11, 2026
Confirming this on 26.908.31748 (build 8720), macOS 15.4.1 — same failure, same stack.
Symptoms
"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:
What I ruled out (so you don't waste time)
initializeagainst the bundledcodex app-serverresponds normallycodesign --verify→ valid on diskCache,Code Cache,GPUCache— identical failure~/.codex/config.tomlDecisive test — an empty
CODEX_HOME+ fresh Chromium profile, onlyauth.jsoncopied 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/udZero user data, same crash. Nothing in your local state causes this — don't delete your config.
While the app is in the crashed state, the renderer writes a default state back to disk on startup. My
~/.codex/.codex-global-state.jsonwent from 1.18 MB / 47 keys → 1.9 KB / 15 keys, and.codex-global-state.json.bakwas overwritten with the same truncated content in the same pass.local-projectsbecame{}.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:
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.sqliteIn my case 752 threads / 129,942 items / 3.6 GB, fully intact. Once the app starts,
Cmd+Kfinds all of them.Rebuilding the project sidebar
Two useful facts:
config.tomlstill 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:
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-hostfills 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
.jsonlcontainscwdand a timestamp, so you can rank paths by last activity.ElierHG commentedon Sep 11, 2026
Windows confirmation - build 26.908.3777.0
I reproduced the same visible startup failure after the Microsoft Store update:
26.908.3777.0(OpenAI.Codex)Microsoft Windows NT 10.0.26200.0 x64(Windows 11 25H2, build 26200.9445)26.908.3777.0as the latest version, so Update ChatGPT had no newer package to install.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:
GPUPersistentCacheGrShaderCacheShaderCacheDefault/CacheDefault/Code CacheDefault/DawnGraphiteCacheDefault/DawnWebGPUCacheDefault/GPUCacheThe 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.
v301eu commentedon Sep 11, 2026
Powered by Codex & OWL
Version 26.908.31457
Released 11 Sept 2026
13 remaining items
yuzhu-oai commentedon Sep 11, 2026
Fixed. Please update to the latest version.
cezarykramp-gif commentedon Sep 11, 2026
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.asarat 2026-09-11 19:51 UTC confirms:app-primary-124c64e4a755.jsimportsn as yZe,t as bZefromauthed-route-95b7e7dbb938.js.authed-routedefines/exports the smartphone icon and initializer, importsjc as nfromapp-primary, and invokesn()at module scope.app-primaryexportsnzn as jc, withnznassigned byvar 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?
zulroxx commentedon Sep 11, 2026
saigyujikingyo-png commentedon Sep 11, 2026
Additional Windows 11 x64 reproduction and official Store fallback comparison for this issue, observed on 11 September 2026.
OpenAI.Codex 26.908.4561.0.26.908.40401, build 8837.r is not a functionunderAppRoutes.Controlled observations with original executable/resources:
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.jsonstill reported26.908.4561.0. A fresh WinGet Store download for x64 / Windows.Desktop / OS 10.0.26200.0 still supplied26.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.
singularitti commentedon Sep 11, 2026
The pet problem seems to be fixed for me on 26.908.40834.
xBrasil commentedon Sep 11, 2026
Still happening for me (Windows 11) on latest version as of today (september 11 2026)
fix: keep Codex 26.908 from crashing into the error page at startup
a3ro-dev commentedon Sep 12, 2026
how to fix this </3
rnagabhyrava commentedon Sep 12, 2026
same issue on linux (ubuntu)
thaccc100-beep commentedon Sep 14, 2026
its still happening windows 11
cch123 commentedon Sep 14, 2026
let your codex cli help you find out the root cause
yuzhu-oai commentedon Sep 14, 2026
Please update to the latest version. It has been fixed. Thanks!
a3ro-dev commentedon Sep 15, 2026
pack it up </3
0sean commentedon Nov 9, 2026
Fixed for me by updating Codex CLI, not just the app