Repository navigation
Description
Description
TypeError: Cannot read properties of undefined (reading 'replaceAll')
at K (http://192.168.0.20:4096/assets/session-BdJIdAn0.js:19:84137)
at Object.fn (http://192.168.0.20:4096/assets/session-BdJIdAn0.js:19:84224)
at H2 (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:6835)
at $l (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:6592)
at Df (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:8033)
at Q7 (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:8914)
at xO (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:8286)
at Ir (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:8218)
at et (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2:3989)
at o (http://192.168.0.20:4096/assets/index-Dr5k_2Nz.js:2279:6842)
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Mar 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
A stack trace alone is not enough context to diagnose or reproduce the issue.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
zhongruan0522 commentedon Mar 26, 2026
I’ve encountered this issue as well. I’m currently on the latest version (1.3.2), and the error persists even after switching computers or browsers; the only time it stops is when I switch to the mobile version.
On my other computer, I even encountered #19217.
bwcx-jzy commentedon Mar 26, 2026
+1
scnbln commentedon Mar 26, 2026
Same issue here — v1.3.2,
opencode servevia systemd on LAN.Environment
opencode serve --port 4096 --hostname 0.0.0.0as a user systemd servicehttp://<ip>:4096)Reproduction
The error occurs consistently when opening the web UI in a browser. The exact same stack trace as reported:
Root cause analysis
Traced through the minified bundle. The crash is in a SolidJS
createMemoinside the session side panel that builds a file tree from diffs:The underlying issue is a reactive timing race in
reconcile(). The event reducer uses:During reconciliation, dependent memos re-evaluate in a transient state where:
diffs()itself may not yet be an array (SolidJS store proxy mid-update →.map is not a function)file: undefined(proxy object not yet populated)This is more likely to trigger over a network (LAN/remote access) due to WebSocket event delivery timing being less deterministic than localhost.
Workaround
Since the web assets are embedded in the bun-compiled binary and can't be patched directly, I set up a bun reverse proxy that intercepts
session-*.jsresponses and applies null guards on-the-fly:__sa(v)— coerces SolidJS store proxies to real arrays viaArray.isArray/Array.fromwith try/catch fallbacknormalizefunction:K=q=>(q||"").replaceAll(...)reduceRightcallback: skip items where_.fileis falsye.diffs()call sites with__sa()(.map,.length,for...of)L.fileaccess in the<For>render callbackThe proxy runs as a separate systemd user service on
:4097, forwarding to the original server on:4096. After applying these patches, the error is gone.Suggested fix
All
diff.fileaccesses insession-side-panel.tsx,session-turn.tsx, andsession-review.tsxneed null guards. Additionally, the memos readingdiffs()should handle the case where the store value is not yet an array duringreconcile()— either by addingArray.isArraychecks or by usingcreateEffectwith deferred reads instead of eagercreateMemo.All debugging — minified source tracing, binary string extraction, DB inspection, server log analysis, and patch development — was performed entirely through opencode itself (TUI via
opencode attach).doge-liang commentedon Mar 26, 2026
111
github-actions commentedon Mar 26, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.
krasen1234 commentedon Mar 26, 2026
TypeError: Cannot read properties of undefined (reading 'replaceAll')
same issue.
adamcohenhillel commentedon Mar 26, 2026
same
joelcomp1 commentedon Mar 26, 2026
seeing this as well
ghiagio commentedon Apr 5, 2026
Same thing, I just run opencode web, and the error is the first thing loaded
RWDai commentedon Apr 6, 2026
I can no longer reproduce this in the latest version. Try the latest version?