You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenCode TUI crashes with a fatal error when trying to access local.agent.current().name because local.agent.current() returns undefined.
Error Message
Full stack trace:
To Reproduce
Open OpenCode TUI
Error appears on startup or during certain operations
TUI crashes with fatal error dialog showing three options: Copy issue URL, Reset TUI, Exit
Expected behavior
TUI should start and run normally without local.agent.current() returning undefined.
Screenshots
Environment
OpenCode Version:
OS:
Terminal:
Node.js:
Installation method:
Root Cause Analysis
The error occurs in src/cli/cmd/tui/component/prompt/index.tsx at line 857. The code attempts to access .name on the result of local.agent.current() without checking if it returns undefined.
Possible causes:
local.agent is not properly initialized
No agent is currently selected but the code assumes one exists
State management issue causing agent data to be lost
Suggested Fix
Add null-safety check before accessing the property:
// Current code (likely)constagentName=local.agent.current().name;// Suggested fixconstcurrentAgent=local.agent.current();constagentName=currentAgent?.name??'Unknown Agent';
Both issues describe the exact same problem where local.agent.current() returns undefined and the code attempts to access .name without null-safety checks.
Feel free to ignore if none of these address your specific case.
Activity
github-actions commentedon Jan 30, 2026
This issue might be a duplicate of existing issues. Please check:
Both issues describe the exact same problem where local.agent.current() returns undefined and the code attempts to access .name without null-safety checks.
Feel free to ignore if none of these address your specific case.
github-actions commentedon Apr 1, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.