Summary
The CLI production code silently swallows errors in 104 places using .catch(() => {}) (or equivalents like .catch(() => undefined), .catch((_) => {})). This is the single most likely explanation for user reports of vague "unreliability" — errors that would help diagnose problems are dropped without any log, telemetry, or user-visible message.
Reproduction / Measurement
grep -rn '\.catch(() => {})\|\.catch((_) => {})\|\.catch(() => undefined)\|\.catch(() => null)' \
packages/opencode/src/ packages/anr-core/src/ packages/llm/src/ \
| grep -v node_modules | grep -v test| wc -l
# → 104Representative Examples
| File:line | What's swallowed |
|---|
packages/opencode/src/config/config.ts:274 | Config-loading failure |
packages/opencode/src/lsp/lsp.ts:362 | LSP initialization failure |
packages/opencode/src/lsp/server.ts:675 | fs.chmod failure on LSP binary |
packages/opencode/src/lsp/server.ts:1055 | fs.chmod on clangd binary |
packages/opencode/src/lsp/server.ts:1058 | fs.unlink for symlink cleanup |
packages/opencode/src/lsp/server.ts:1059 | fs.symlink for clangd |
packages/opencode/src/lsp/server.ts:1347 | Launcher script chmod |
packages/opencode/src/plugin/tui/runtime.ts:273 | PluginMeta.setTheme failure |
packages/opencode/src/plugin/tui/runtime.ts:302 | Filesystem.write failure |
packages/opencode/src/plugin/tui/runtime.ts:307 | Plugin runtime setup |
packages/opencode/src/plugin/tui/runtime.ts:680 | Async wait |
packages/opencode/src/plugin/xai.ts:606 | xAI provider network |
packages/opencode/src/plugin/digitalocean.ts:314 | DigitalOcean provider |
packages/opencode/src/plugin/snowflake-cortex.ts:338,375 | Snowflake Cortex provider |
packages/opencode/src/cli/upgrade.ts:52 | Auto-update result emit |
Policy — What Each Should Become
- Truly ignorable (e.g., best-effort cleanup that legitimately can't fail loudly): replace with
.catch((err) => log.debug({ msg: "ignored", err })) — never bare {}. - User action needed (config load, auth, provider init): re-throw or wrap in a typed error and surface to the TUI.
- Diagnostic-only (telemetry, cache): keep silent but record via OTEL.
Acceptance Criteria
Related
Scope
In scope:packages/opencode/src/, packages/anr-core/src/, packages/llm/src/
Out of scope: test files, tools/scripts, and packages/core/src/ (already largely uses Effect's typed errors)
Summary
The CLI production code silently swallows errors in 104 places using
.catch(() => {})(or equivalents like.catch(() => undefined),.catch((_) => {})). This is the single most likely explanation for user reports of vague "unreliability" — errors that would help diagnose problems are dropped without any log, telemetry, or user-visible message.Reproduction / Measurement
Representative Examples
packages/opencode/src/config/config.ts:274packages/opencode/src/lsp/lsp.ts:362packages/opencode/src/lsp/server.ts:675fs.chmodfailure on LSP binarypackages/opencode/src/lsp/server.ts:1055fs.chmodon clangd binarypackages/opencode/src/lsp/server.ts:1058fs.unlinkfor symlink cleanuppackages/opencode/src/lsp/server.ts:1059fs.symlinkfor clangdpackages/opencode/src/lsp/server.ts:1347packages/opencode/src/plugin/tui/runtime.ts:273PluginMeta.setThemefailurepackages/opencode/src/plugin/tui/runtime.ts:302Filesystem.writefailurepackages/opencode/src/plugin/tui/runtime.ts:307packages/opencode/src/plugin/tui/runtime.ts:680packages/opencode/src/plugin/xai.ts:606packages/opencode/src/plugin/digitalocean.ts:314packages/opencode/src/plugin/snowflake-cortex.ts:338,375packages/opencode/src/cli/upgrade.ts:52Policy — What Each Should Become
.catch((err) => log.debug({ msg: "ignored", err }))— never bare{}.Acceptance Criteria
.catch(() => {})in prod code drops to ≤10, and each remaining occurrence has an inline comment explaining why silence is correct..catch(() => {})unless justified.Related
Scope
In scope:
packages/opencode/src/,packages/anr-core/src/,packages/llm/src/Out of scope: test files, tools/scripts, and
packages/core/src/(already largely uses Effect's typed errors)