Skip to content

Empty catch blocks hide errors in cleanup operations #18239

Closed as not planned
Closed as not planned

Description

@huaiyuWangh

Description

Several catch blocks in the codebase are empty, silently ignoring errors during cleanup operations (killing processes, destroying services). This makes debugging difficult when cleanup fails.

Affected Files

  • packages/opencode/src/mcp/index.ts:232 - Killing MCP descendant processes
  • packages/opencode/src/pty/index.ts:99, 232 - Killing PTY processes
  • packages/opencode/src/server/mdns.ts:40 - Destroying bonjour instance

Current Behavior

try {
  process.kill(dpid, "SIGTERM")
} catch {}  // Error is completely hidden

Expected Behavior

These errors should be logged at debug level so developers can see what's happening during cleanup, even when failures are expected (e.g., process already exited).

Proposed Solution

Add debug logging to these catch blocks:

try {
  process.kill(dpid, "SIGTERM")
} catch (err) {
  log.debug("Failed to kill descendant process", { pid: dpid, error: err })
}

Impact

  • Low impact: These are cleanup operations where failures are often expected
  • Improves debuggability during development
  • Follows better error handling practices

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 19, 2026
  2. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 3, 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