Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

TUI crash: undefined is not an object (evaluating 'r.text.feedback[t.toast.variant].base')

Đang mở Phù hợp với người mới
#54,762 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

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.

  • #54802 của @Finn763 — đang mở
  • #54817 của @Ji-Sir — đã đóng, không merge

Đá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
Lĩnh vực
frontend, tooling

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ả

reproduced

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

  1. Add a TUI plugin in ~/.config/opencode/plugins/ that calls context.ui.toast.show({ message: "hello", variant: "warn" }) — invalid: the variant union at packages/tui/src/ui/toast.tsx:11 is "info" | "success" | "warning" | "error", and text.feedback in packages/theme/src/tui/schema.ts only defines error / warning / success / info.
  2. Trigger the call (e.g. from a palette/slash command).
  3. 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 to info for unknown values;
  • the theme lookup at toast.tsx:54 guards 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 are Schema.optional in packages/theme/src/tui/schema.ts:94-101) — kills the whole TUI. There is no error boundary in the toast render path.
  • The warn vs warning mismatch is an easy mistake for plugin authors: the variant key is warning, while log levels elsewhere use warn (e.g. client.app.log levels: 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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.