Repository navigation
Description
Bug Summary
After upgrading to [email protected], the sidecar process crashes with exit code 1 immediately after processing the first successful request. All subsequent requests fail with "failed to fetch" because the sidecar is no longer running.
Pattern: First request → succeeds ✅ → sidecar crashes 💥 → all following requests → "failed to fetch" ❌
Environment
- OpenCode Desktop: v1.14.48 (macOS arm64)
- oh-my-openagent: v4.1.1 (auto-updated from npm via
"plugin": ["oh-my-openagent@latest"]) - @opencode-ai/plugin: v1.14.48
- @opencode-ai/sdk: v1.14.48
- Platform: macOS Darwin (Apple Silicon M-series)
- Node.js sidecar: Uses
oh-my-openagent-darwin-arm64binary
Regression Evidence
The package was auto-updated at 2026-05-13 22:42:29 UTC+8. Sidecar crashes began immediately after:
| Time | Event | Exit Code |
|---|---|---|
| 22:42:21 | Sidecar normal exit (before update) | 0 ✅ |
| 22:42:29 | package-lock.json updated → v4.1.1 installed |
— |
| 22:42:24 | New sidecar spawned | — |
| 22:44:17 | First crash after update | 1 ❌ |
| 22:45:32 | Crash | 1 ❌ |
| 22:46:26 | Crash (only ~20s uptime) | 1 ❌ |
| ... | All subsequent exits are code 1 | 1 ❌ |
Before this update, all sidecar exits were code: 0 (normal).
Sidecar Log Pattern
From ~/Library/Logs/@opencode-ai/desktop/main.log:
[2026-05-14 00:13:41.285] [info] sidecar connection started { url: 'http://127.0.0.1:53922' }
[2026-05-14 00:13:41.286] [info] spawning sidecar { url: 'http://127.0.0.1:53922' }
[2026-05-14 00:13:41.606] [warn] sidecar stderr { message: '(node:72159) ExperimentalWarning: SQLite is an experimental feature...' }
[2026-05-14 00:13:42.326] [info] server ready { url: 'http://127.0.0.1:53922' }
[2026-05-14 00:14:31.128] [warn] sidecar exited { code: 1 } ← ~49s uptime, after first request
The sidecar starts successfully, serves one request, then crashes.
Config
~/.config/opencode/opencode.json (relevant section):
{
"plugin": ["oh-my-openagent@latest"]
}~/.config/opencode/oh-my-openagent.json (model config):
{
"agents": {
"sisyphus": { "model": "zai-coding-plan/glm-5.1" },
"oracle": { "model": "zai-coding-plan/glm-5.1" },
"explore": { "model": "minimax-cn/MiniMax-M2.7" },
"librarian": { "model": "minimax-cn/MiniMax-M2.7" }
},
"categories": {
"quick": { "model": "minimax-cn/MiniMax-M2.7" },
"deep": { "model": "zai-coding-plan/glm-5.1" }
}
}Connected providers: openrouter, minimax-cn, zai-coding-plan, deepseek, opencode
MCP servers configured: MiniMax (local), zai-vision (local), plus 3 disabled remote MCPs.
Steps to Reproduce
- Install OpenCode Desktop v1.14.48
- Configure
oh-my-openagent@latestas plugin (resolves to v4.1.1) - Start OpenCode → sidecar spawns successfully
- Send first chat message → receives response correctly
- Send second chat message →
"failed to fetch"error - Observe sidecar has exited with code 1 in logs
Workaround
Locking to the previous version avoids the crash:
{
"plugin": ["[email protected]"]
}Then clear the cached package:
rm -rf ~/.cache/opencode/packages/oh-my-openagent@latestAdditional Notes
- No crash reports generated in
~/Library/Logs/DiagnosticReports/ - No proxy configured (
HTTP_PROXY/HTTPS_PROXYunset) NO_PROXY=127.0.0.1,localhost,::1- The SQLite experimental warning appears on every sidecar start (likely unrelated but noting for completeness)
- The sidecar process (
oh-my-openagent-darwin-arm64) is a Mach-O 64-bit ARM64 binary wrapping Node.js - Source
dist/index.jscontainsprocess.exit()(bare, no code) at one location, pluskillProcessGroupsignal handlers — the crash may originate from an unhandled rejection or signal handler
Activity
UncleXJ commentedon May 14, 2026
Windows 11 reproduction (same symptoms)
I can confirm this issue on Windows 11 with:
Same Pattern
First request succeeds, then sidecar crashes with exit code 1. Every subsequent request fails with connection error until sidecar auto-restarts.
Timeline (main.log)
Root Cause Analysis
I traced through the OMO source code and found the crash mechanism:
src/features/background-agent/process-cleanup.ts registers error handlers:
egisterErrorEvent calls scheduleForcedExit(handler(error), 1, true) which eventually calls process.exit(1)
Corroborating Evidence
Workaround
Rolling back to v4.0.0 resolves the crash (but loses tolerantFsyncSync needed for NTFS junctions on Windows).
yanxiaodong2026-debug commentedon May 14, 2026
我现在回滚到4.0.0执行复杂任务还是会出现,方便留个联系方式联系一下吗
UncleXJ commentedon May 14, 2026
UncleXJ commentedon May 15, 2026
Temporary Workaround (Local Patch)
Until this is fixed upstream, we patched
registerErrorEventindist/index.jsto suppressAbortErrorandTypeErrorfrom triggeringprocess.exit(1):`javascript
// In registerErrorEvent listener (around line 111618)
const listener = (error) => {
process.off(signal, listener);
console.error('[OMO-CRASH-DEBUG] ' + signal + ' caught:', error?.message || error);
// --- PATCH START: suppress known non-fatal errors ---
if (error?.name === 'AbortError') {
log('warn', [OMO] Suppressing AbortError (OpenCode session.processor known issue #26667));
return; // Don't exit
}
if (error instanceof TypeError) {
log('warn', [OMO] Suppressing TypeError: );
return; // Don't exit - e.g. ctx.$ is not a function
}
// --- PATCH END ---
log('error', [OMO] :, error);
scheduleForcedExit(handler(error), 1, true);
};
`
This prevents the two known crash paths:
ctx.$ is not a function(TypeError) insendSessionNotification/playSessionNotificationSoundAbortErrorfrom OpenCodesession.processor(issue #26667)Both are non-fatal errors that should not cause a sidecar crash.
Note: This patch must be reapplied after every OMO update since it modifies
dist/index.jsdirectly.nieaowei commentedon May 15, 2026
Good way.
code-yeongyu commentedon May 16, 2026
[sisyphus-bot]
Confirmed. Current
devstill contains the fatal paths described in this report, so this should stay open as a real process-lifecycle bug/regression. I assignedcode-yeongyubecause the fix needs an owner decision on which errors are safe to suppress versus which should still terminate the sidecar.Code evidence:
src/features/background-agent/process-cleanup.ts:70-86registers globaluncaughtException/unhandledRejectionlisteners and routes both throughscheduleForcedExit(handler(error), 1, true).src/features/background-agent/process-cleanup.ts:39-52setsprocess.exitCode, starts a forced-exit timer, and callsprocess.exit(exitCode)after cleanup whenexitAfterCleanupis true.src/features/background-agent/process-cleanup.ts:140-149only skips these global error handlers whenOMO_DISABLE_PROCESS_CLEANUPis set; there is no built-in suppression for non-fatalAbortErroror notification-relatedTypeError.src/hooks/session-notification-sender.ts:51-105still callsctx.$directly for desktop notification commands. If the Desktop sidecar/plugin context lacks a valid shell helper, that can throwTypeErrorand flow into the same global fatal-exit handler.This matches the user reports across macOS and Windows: a first request can succeed, then a later unhandled rejection/exception path can terminate the sidecar with exit code 1. The linked local workaround that suppresses
AbortErrorandTypeErroris consistent with the code, but the real fix should be more deliberate than catching everyTypeErrorglobally.Recommended fix direction:
ctx.$cannot crash the process.AbortErrorand notification shell-helper failures do not force-exit, while genuinely fatal cleanup errors still remain observable.Labels applied:
bug,confirmed,triage:bug.Assignee added:
code-yeongyufor the process-lifecycle policy decision.97lj commentedon May 16, 2026
在oh-my-openagent.jsonc配置里"disabled_hooks": ["session-notification"]即可,只是关闭了系统通知,不影响核心功能,这样OMO更新也不需要重新打补丁
UncleXJ commentedon May 16, 2026
Thanks to @97lj for the
disabled_hooks: ["session-notification"]workaround! On macOS + Windows Desktop with OMO v4.1.2, this prevents the sidecar crash.Question: what does disabling
session-notificationaffect? Any lost functionality or side effects?97lj commentedon May 16, 2026
暂时没发现有什么副作用,使用AI分析的结果,崩溃发生在 registerErrorEvent → sendSessionNotification,因为 ctx.$ 不存在。这是通知系统内部的 bug,不影响任何核心功能。sendSessionNotification的功能是发送系统托盘通知(会话完成/错误/需要输入),禁用 session-notification 等于关掉了一个纯装饰性的通知功能,对实际使用零影响。目前我使用上是正常的,在opencode 1.15.0和1.15.3上使用正常。
mguttmann commentedon May 17, 2026
Filed a separate issue #4120 with the macOS arm64
napi_fatal_error/ SIGABRT stack trace (top frames:node::OnFatalError→napi_fatal_error→callbackEventsToJS→Napi::ThreadSafeFunction::CallJS), and submitted a PR as #4122.Important caveat to other reporters here: my PR addresses a different code path than the
ctx.$ is not a function/session-notification-sender.tsroot cause that @code-yeongyu's bot identified above. Thedisabled_hooks: ["session-notification"]workaround from @97lj is probably more effective for the notification-path crashes. My fix targets a parent-wake race influshPendingParentWakewheredispatchInternalPromptand a fresh user message land on the same session-storage file within the watcher's batch window — that triggers anapi_fatal_errorin@parcel/watcher's TSFN callback when the session view has just re-mounted.So there are likely two distinct crash paths producing the same "exit code 1" symptom:
ctx.$undefined in notification sender (covered bydisabled_hooksworkaround, needs the deeper fix the bot suggested)Both should ideally be fixed. If you're hitting this and
disabled_hooks: ["session-notification"]does not stop the crash for you, the parent-wake race in #4122 may be your variant — happy to compare DiagnosticReports.code-yeongyu commentedon May 18, 2026
[sisyphus-bot] Status update
Both crash paths in this issue are now being addressed:
Path 2 — Parent-wake race against @parcel/watcher TSFN (the
napi_fatal_error/ SIGABRT variant on macOS arm64 documented in #4120):devat6037b91706e46d9468a685eeb66f88c3069daa0d(2026-05-18 02:06 UTC)flushPendingParentWakewhen a user message arrived inside the post-dispatch hold window, andunref()s long-lived bookkeeping timers so the host can tear down cleanly.Path 1 —
ctx.$ is not a functionTypeError from session-notification-sender:src/features/background-agent/process-cleanup.tswas already rewritten log-only ondev(theuncaughtException/unhandledRejectionlisteners now log + return, they do not callscheduleForcedExitanymore — see commit history on that file). So theprocess.exit(1)path I described above is gone fromdev; what shipped inv4.1.xstill has it, which is why users on the published binary still see exit code 1, while users on a freshly-builtdevsee the TypeError logged but the host stays alive.sendSessionNotificationandplaySessionNotificationSoundwill return early whentypeof ctx?.$ !== "function", so the TypeError is never thrown in the first place. That eliminates the symptom on bothdevand (once published) for users on the released binary.For users currently affected on a published version:
disabled_hooks: ["session-notification"]workaround from @97lj remains the cleanest mitigation until the next release.devlocally, the v4.2.0 line already contains the process-cleanup log-only rewrite, so the sidecar will no longer exit on the TypeError even before the source-side guard lands.This issue will be closed once the source-side guard PR merges. Tracking under @sisyphus-bot.
Merge pull request #4127 from code-yeongyu/fix/3997-notification-crash
code-yeongyu commentedon May 18, 2026
[sisyphus-bot] Resolved on
dev. All three crash paths in this issue are now addressed.dev@parcel/watcherTSFNnapi_fatal_error/ SIGABRT (mostly macOS arm64, per #4120)flushPendingParentWakewhile a fresh user message is still being processed;unref()long-lived bookkeeping timers6037b917(merge), source329412827uncaughtException→scheduleForcedExit(1, true)registerErrorEventnow detaches the listener and only logs (describeProcessCleanupError). No moreprocess.exit(1)from transient rejections. Already on currentdev; predates this triage.devbefore this issue)TypeError: ctx.$ is not a functionfromsendSessionNotification/playSessionNotificationSoundv4.1.x(where the force-exit path still exists)canRunNotificationCommandguard that checkstypeof ctx?.$ === "function"before invoking the shell helper. Logs once on first observation, returns early after that. Both notification + sound paths covered.c4dd21e1(merge), source397ed1048Status:
devcurrently contains all three fixes.v4.1.2,4.0.0) still ships path 2 and path 3 unguarded — users on those versions will keep hitting the crash until the next release.disabled_hooks: ["session-notification"](the workaround from @97lj) remains the cleanest mitigation. Rolling back to4.0.0is not necessary if the workaround is acceptable.Verification:
cubic-dev-aiautomated review (5/5 confidence, no issues found).dev's log-onlyprocess-cleanup.tsunchanged — eliminating the TypeError at its source rather than catching it downstream, which is the deliberate fix scope per the owner's earlier guidance ("the real fix should be more deliberate than catching every TypeError globally").Closing this issue. A new release is needed to ship these fixes to users on
v4.1.x. If you reproduce the crash on a build from currentdev, please reopen with a fresh~/Library/Logs/DiagnosticReports/entry and theoh-my-opencode.logtail.Thanks to @ThomasChangX for the original report, @UncleXJ for the Windows reproduction + workaround patch, @97lj for the
disabled_hooksworkaround, and @mguttmann for #4122 / the parent-wake race analysis.fix(hooks): guard session-notification against missing ctx.$ (refs co…