Skip to content

[BUG] ~30 catch blocks silently swallow errors across core modules #24327

@alfredocristofano

Description

@alfredocristofano

Description

Found ~30 instances of catch {} or catch { } in production code that suppress errors completely without any logging.

Most critical locations:

  • auth/index.ts:62 — JSON.parse of OPENCODE_AUTH_CONTENT fails silently, causing auth to be silently absent
  • session/message-v2.ts:1191 — stream error JSON parse fails silently
  • session/session.ts:508 — session remove() catches error but lets it succeed anyway
  • lsp/client.ts:150 — server stderr at debug level (startup errors invisible by default)
  • pty/index.ts:125 — process kill/close failures could create zombie processes
  • mcp/index.ts:524 — SIGTERM failures not reported
  • global/index.ts:54 — cache directory cleanup failure not logged
  • provider/error.ts:71 — JSON parse errors in response handling not logged
  • util/filesystem.ts — statSync, realpathSync, glob scan failures not logged
  • util/error.ts:11 — JSON.stringify failure not logged

Also session/llm.ts:258 uses catch (e: any) instead of catch (e: unknown).

Reproduction steps

  1. Search for catch {} or catch { } in packages/opencode/src/
  2. Observe that no logging occurs within these blocks
  3. Errors that cause failures in these paths are silently lost

Environment info

  • OS: all platforms
  • Bun version: 1.3.x
  • OpenCode version: current dev branch

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions