Skip to content

Worker's uncaughtException and unhandledRejection handlers are empty, so worker crashes leave no trace #47113

Closed as not planned

Description

@maxmad64bis

Description

Both process-level handlers in packages/opencode/src/cli/tui/worker.ts are empty functions:

const onUnhandledRejection = (_error: unknown) => {}

const onUncaughtException = (_error: Error) => {}

process.on("unhandledRejection", onUnhandledRejection)
process.on("uncaughtException", onUncaughtException)

Registering a handler suppresses Node's default behaviour — print the stack, exit non-zero — so an empty one turns a worker crash into silence. Nothing is written to the log, and the TUI keeps talking to a worker that may be gone.

#42885 covers the RPC path (a throwing handler, a killed worker), but it doesn't touch these two handlers, so a failure that never crosses the RPC boundary stays invisible.

Logging the error before returning would be enough — synchronously, since the process may be about to exit. In a build where the handler does that, the one crash it caught over several weeks was Error: EIO: i/o error, write, which is otherwise lost entirely.

Happy to open a PR if that's welcome.

Steps to reproduce

  1. In packages/opencode/src/cli/tui/worker.ts, add setTimeout(() => { throw new Error("boom") }, 4000) before the process.on calls.
  2. Run bun dev .
  3. After 4 seconds: the TUI is still up, boom appears nowhere — not on stdout, not in the log directory.

OpenCode version

1.18.27

Operating System

Ubuntu 24.04 (WSL2)

Terminal

Ubuntu-24.04

Activity

  1. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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