Skip to content

TUI blank screen in non-pure mode with external plugin; setRawMode failed with errno: 9 (macOS) #26217

Closed as not planned

Description

@danisharora099

Summary

opencode fails to render the TUI in non-pure mode when an external plugin is configured (oh-my-openagent / oh-my-opencode). The same machine/session works with opencode --pure.

Environment

  • OS: macOS (darwin 25.4.0)
  • Shell: zsh
  • Terminal: Ghostty (also reproduced in Cursor terminal)
  • OpenCode: 1.14.30
  • Plugin config tested with both identifiers:
    • oh-my-openagent
    • oh-my-opencode

Reproduction

  1. Put plugin in global OpenCode config:
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["oh-my-opencode"]
    }
    (same behavior with "oh-my-openagent")
  2. Run opencode
  3. Observe blank/empty TUI (no usable UI)
  4. Run opencode --pure
  5. Pure mode works normally in the same environment

Actual Behavior

  • opencode (non-pure): blank screen / unusable TUI
  • opencode --pure: works
  • opencode web: works

Expected Behavior

Non-pure mode should render and accept input like pure mode.

Relevant Logs

Latest failing non-pure log (~/.local/share/opencode/log/2026-05-07T164750.log) shows normal initialization followed by raw-mode failure:

INFO  ... service=default directory=/Users/... bootstrapping
INFO  ... service=plugin name=... loading internal plugin
ERROR ... setRawMode failed with errno: 9 exception
ERROR ... error=setRawMode failed with errno: 9 process error

Earlier sessions also show identical error signature.

Diagnostics Attempted

  • Forced terminal type:
    • TERM=xterm-256color opencode --print-logs --log-level DEBUG
  • Tested with/without plugin identifier rename compatibility (oh-my-openagent vs oh-my-opencode)
  • Added TUI/system theme setting
  • Cleared/repopulated plugin cache paths and reinstalled plugin packages
  • Verified OpenCode itself is functional via:
    • opencode --pure
    • opencode web

Why this seems like OpenCode TUI non-pure path

Under same machine and terminal, pure mode works but non-pure hits setRawMode ... errno: 9 after startup. That strongly suggests TTY/raw-mode handling breaks in external-plugin path (or plugin-host handoff), not a generic terminal incompatibility.

Request

Please advise if there is:

  1. A known fix/workaround for setRawMode failed with errno: 9 in non-pure mode on macOS
  2. Any debug flags to trace TTY fd state around raw mode setup
  3. A recommended plugin-loading compatibility mode for this case

Activity

  1. github-actions commented on May 7, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue body is completely empty — no template was used and no content was provided. Please use one of the required issue templates (Bug Report, Feature Request, or Question) and fill in all required fields, including a description of the problem, steps to reproduce, and your environment/system information.

    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.

  2. danisharora099 commented on May 7, 2026

    @danisharora099
    Author

    Adding full reproduction details here since the issue body is not persisting via CLI/API update on this repo.

    Detailed Repro + Diagnostics

    Environment

    • macOS darwin 25.4.0
    • zsh
    • Ghostty terminal (also reproduced in Cursor terminal)
    • OpenCode 1.14.30

    Plugin Config

    Tested both plugin identifiers in ~/.config/opencode/opencode.json:

    • oh-my-openagent
    • oh-my-opencode

    Behavior

    • opencode => blank/unusable TUI in non-pure mode
    • opencode --pure => works
    • opencode web => works

    Key Error

    From ~/.local/share/opencode/log/2026-05-07T164750.log:
    ERROR ... setRawMode failed with errno: 9 exception
    ERROR ... error=setRawMode failed with errno: 9 process error

    Attempted Fixes

    • Forced terminal type TERM=xterm-256color
    • Added system theme in OpenCode TUI config
    • Tested both plugin identifiers (rename compatibility)
    • Preinstalled plugin cache entries manually
    • Reproduced consistently: only non-pure path fails

    Why this looks non-pure TUI/TTY specific

    Same machine and terminal session:

    • pure mode stable
    • non-pure mode fails at raw-mode setup (errno 9)

    Could you share recommended debug flags or a workaround for TTY/raw-mode initialization when external plugin loading is enabled?

  3. github-actions commented on May 7, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now includes all the required information — environment details, clear reproduction steps, actual vs expected behavior, and relevant logs. Much appreciated!

  4. wolkat commented on Jun 2, 2026

    @wolkat

    Local reproduction evidence (v1.15.13, macOS Darwin)

    Can confirm this bug with detailed local logs. Running OpenCode v1.15.13 on macOS (Darwin 25.4.0, zsh). Every crash session shows the same pattern: oh-my-openagent TUI plugin loads without a TUI entrypoint, then setRawMode fails within minutes.

    Crash pattern in non-pure mode

    Four crash events captured in ~/.local/share/opencode/log/, all following the identical sequence:

    INFO  service=tui.plugin path=oh-my-openagent retry=false loading tui plugin
    WARN  service=tui.plugin path=oh-my-openagent retry=false message=Plugin oh-my-openagent does not expose a tui entrypoint tui plugin has no entrypoint
    ... (1-8 minutes of normal operation) ...
    ERROR service=default e=setRawMode failed with errno: 9 exception
    ERROR service=default error=setRawMode failed with errno: 9 process error
    ERROR service=default e=EIO: i/o error, write exception
    INFO  service=default worker shutting down
    INFO  service=default disposing all instances
    

    Crash timeline:

    # TUI log Start time Crash time Uptime Followed by EIO
    1 2026-06-01T224000 22:40:00 22:48:19 8m19s Yes
    2 2026-06-01T224821 22:48:21 22:49:59 1m38s No
    3 2026-06-01T225501 22:55:01 12:12:15 (next day) ~13h Yes

    Crashes #1 and #2 are a rapid double-crash — the first crash corrupts terminal state, and the second attempt fails within 94 seconds.

    --pure mode: zero errors

    Tested with opencode --pure — the TUI log confirms all external plugins are skipped:

    INFO  args=["--pure"]
    INFO  service=tui.plugin count=1 skipping external tui plugins in pure mode
    INFO  service=tui.plugin id=internal:home-footer loading internal tui plugin
    ... (internal plugins only, no oh-my-openagent) ...
    

    The server log likewise shows:

    INFO  service=plugin count=5 skipping external plugins in pure mode
    

    Result: zero setRawMode errors, zero EIO errors, stable session.

    Root cause correlation

    The oh-my-openagent plugin is loaded in every non-pure crash session but explicitly excluded in every stable --pure session. The "does not expose a tui entrypoint" warning appears immediately before the setRawMode failure in all three crash logs. This is consistent with the hypothesis that the plugin loading path in non-pure mode interferes with the TUI's TTY/raw-mode initialization.

    Environment

    • OpenCode: v1.15.13
    • OS: macOS Darwin 25.4.0
    • Shell: zsh
    • Plugin: oh-my-openagent@latest in ~/.config/opencode/opencode.json
  5. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions