TUI crash: undefined is not an object (evaluating 'r.text.feedback[t.toast.variant].base')
Maintainer thường phản hồi trong vòng 1 ngày
@Finn763 đang làm issue này rồi.
Từ ngày 12/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu tại packages/tui/src/ui/toast.tsx, đặc biệt là phần tra cứu theme ở dòng 54, và đọc kiểu biến thể toast ở dòng 11 cùng với schema feedback trong packages/theme/src/tui/schema.ts. Tái hiện lỗi bằng một biến thể không hợp lệ như warn hoặc một theme tùy chỉnh chưa đầy đủ, thiếu mục tương ứng. Hoàn thành khi mục feedback không hợp lệ hoặc bị thiếu không còn làm TUI gặp sự cố; issue không chỉ định tệp kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The TUI hard-crashes when a plugin calls ui.toast.show() with a toast variant that is not a valid theme feedback key. The theme lookup in packages/tui/src/ui/toast.tsx:54 is unguarded:
borderColor={theme.text.feedback[props.toast.variant].base}
A single invalid variant string from a third-party plugin (in my case "warn" instead of "warning") throws a TypeError in the render pass and takes down the entire TUI with the crash screen. My plugin's call was wrapped in try/catch, but the exception fires later during rendering, so plugin-level fail-open wrappers cannot catch it.
Environment
- opencode version: 2.0.27
- OS: macOS 24.6.0 (darwin x64)
- Terminal: tmux 3.6a
- Shell: /bin/zsh
- Install/channel: latest
- Active plugins: local global plugins in
~/.config/opencode/plugins/—brain-logger.js,identity-anchor.js,pantheon-hub/(TUI plugin; crash trigger)
Reproduction
- Add a TUI plugin in
~/.config/opencode/plugins/that callscontext.ui.toast.show({ message: "hello", variant: "warn" })— invalid: the variant union atpackages/tui/src/ui/toast.tsx:11is"info" | "success" | "warning" | "error", andtext.feedbackinpackages/theme/src/tui/schema.tsonly defineserror/warning/success/info. - Trigger the call (e.g. from a palette/slash command).
- The toast renders → TypeError → full TUI crash screen.
Expected Behavior
One (or more) of:
ui.toast.show()validates/clamps the variant at the plugin API boundary, falling back toinfofor unknown values;- the theme lookup at
toast.tsx:54guards against missing entries with a fallback color; - at minimum the error surfaces in the plugin's call frame rather than crashing the whole TUI render.
Actual Behavior
TypeError: undefined is not an object (evaluating 'r.text.feedback[t.toast.variant].base') — the entire TUI crashes.
Relevant stack frames:
at <anonymous> (chunk-k3c2wewa.js:2590:13646) ← toast render, unguarded theme lookup
at show (chunk-k3c2wewa.js:2590:14589)
at show (chunk-k3c2wewa.js:2592:29350)
at run (~/.config/opencode/plugins/pantheon-hub/tui.tsx:264:34) ← plugin command handler
Additional Context
- The triggering call was my own plugin bug (
"warn"is not a valid variant), but the reportable issue is that any plugin passing an invalid variant string — or a variant whose entry is missing from a partial custom theme (text.feedback.*entries areSchema.optionalinpackages/theme/src/tui/schema.ts:94-101) — kills the whole TUI. There is no error boundary in the toast render path. - The
warnvswarningmismatch is an easy mistake for plugin authors: the variant key iswarning, while log levels elsewhere usewarn(e.g.client.app.loglevels:debug,info,warn,error).
Full stack trace from the crash screen
Error: undefined is not an object (evaluating 'r.text.feedback[t.toast.variant].base')
at <anonymous> (/$bunfs/root/chunk-k3c2wewa.js:2590:13646)
at Ve (/$bunfs/root/chunk-qxet3sb1.js:2:9872)
at K (/$bunfs/root/chunk-qxet3sb1.js:2:9653)
at T_ (/$bunfs/root/chunk-qxet3sb1.js:2:3651)
at <anonymous> (/$bunfs/root/chunk-k3c2wewa.js:2590:13574)
at qi (/$bunfs/root/chunk-qxet3sb1.js:2:6895)
at Ve (/$bunfs/root/chunk-qxet3sb1.js:2:9872)
at K (/$bunfs/root/chunk-qxet3sb1.js:2:9653)
at Z (/$bunfs/root/chunk-qxet3sb1.js:2:11338)
at $e (/$bunfs/root/chunk-qxet3sb1.js:2:12211)
at wt (/$bunfs/root/chunk-qxet3sb1.js:2:11613)
at D (/$bunfs/root/chunk-qxet3sb1.js:2:11518)
at g (/$bunfs/root/chunk-j7geqk7h.js:3:23104)
at show (/$bunfs/root/chunk-k3c2wewa.js:2590:14589)
at show (/$bunfs/root/chunk-k3c2wewa.js:2592:29350)
at run (/Users/dev10/.config/opencode/plugins/pantheon-hub/tui.tsx:264:34)
at a (/$bunfs/root/chunk-qt5e0j2h.js:2:31593)
at u (/$bunfs/root/chunk-qt5e0j2h.js:2:32383)
at d (/$bunfs/root/chunk-qt5e0j2h.js:2:32909)
at a (/$bunfs/root/chunk-qt5e0j2h.js:2:92434)
at run (/$bunfs/root/chunk-qt5e0j2h.js:2:97068)
at Ze (/$bunfs/root/chunk-wp49df1n.js:27:10030)
at run (/$bunfs/root/chunk-wp49df1n.js:27:11283)
at a (/$bunfs/root/chunk-qt5e0j2h.js:2:31593)
at runBinding (/$bunfs/root/chunk-qt5e0j2h.js:2:34042)
at Se (/$bunfs/root/chunk-qt5e0j2h.js:2:54571)
at Be (/$bunfs/root/chunk-qt5e0j2h.js:2:48704)
at Ne (/$bunfs/root/chunk-qt5e0j2h.js:2:47228)
at Te (/$bunfs/root/chunk-qt5e0j2h.js:2:46395)
at <anonymous> (/$bunfs/root/chunk-qt5e0j2h.js:2:67932)
at emitWithPriority (/$bunfs/root/chunk-43sqsmcd.js:28:10236)
at processParsedKey (/$bunfs/root/chunk-43sqsmcd.js:28:9705)
at handleStdinEvent (/$bunfs/root/chunk-43sqsmcd.js:203:5433)
at <anonymous> (/$bunfs/root/chunk-43sqsmcd.js:203:4996)
at drain (/$bunfs/root/chunk-43sqsmcd.js:34:9334)
at drainStdinParser (/$bunfs/root/chunk-43sqsmcd.js:203:4968)
at <anonymous> (/$bunfs/root/chunk-43sqsmcd.js:203:2834)
at emit (node:events:100:22)
at addChunk (internal/streams/readable:267:47)
at readableAddChunkPushByteMode (internal/streams/readable:245:18)
at internalRead (native)
at processTicksAndRejections (native)
- Ngôn ngữ chính
- TypeScript
- Star
- 221k
- Fork
- 29.6k
- Merge trung bình
- 5 giờ 22 phút
- Pull request đã merge (30 ngày)
- 531
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
Local copy writes the clipboard natively and via OSC 52 at once, racing the terminal (macOS)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
anomalyco/opencode#59052 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/opencode#59040 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
anomalyco/opencode#58981 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
anomalyco/opencode#58821 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
anomalyco/opencode#58774 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
galaxyproject/loom#616 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
redhat-developer/rhdh-plugin-export-overlays#4580 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
eknowledger/toolbench#266 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
devdotfast/whiteboard#1415 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày