{"record":{"id":"efa5daa20ad53628","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-warning-failed-to-stop-notify-fallback-watc","errorCode":null,"errorMessage":"[omx] warning: failed to stop notify fallback watcher process","messagePattern":"\\[omx\\] warning: failed to stop notify fallback watcher process","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/index.ts","lineNumber":7902,"sourceCode":"        error: error instanceof Error ? error.message : String(error),\n      },\n    );\n  });\n}\n\nasync function stopNotifyFallbackWatcher(cwd: string): Promise<void> {\n  const { readFile, unlink } = await import(\"fs/promises\");\n  const pidPath = notifyFallbackPidPath(cwd);\n  if (!existsSync(pidPath)) return;\n\n  try {\n    const pid = parseWatcherPidFile(await readFile(pidPath, \"utf-8\"));\n    if (pid) {\n      tryKillPid(pid, \"SIGTERM\");\n    }\n  } catch (error: unknown) {\n    if (!hasErrnoCode(error, \"ESRCH\")) {\n      console.warn(\n        \"[omx] warning: failed to stop notify fallback watcher process\",\n        {\n          path: pidPath,\n          error: error instanceof Error ? error.message : String(error),\n        },\n      );\n    }\n  }\n\n  await unlink(pidPath).catch((error: unknown) => {\n    console.warn(\n      \"[omx] warning: failed to remove notify fallback watcher pid file\",\n      {\n        path: pidPath,\n        error: error instanceof Error ? error.message : String(error),\n      },\n    );\n  });","sourceCodeStart":7884,"sourceCodeEnd":7920,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L7884-L7920","documentation":"While stopping the notify fallback watcher, reading/parsing the PID file or signalling the PID threw an error other than ESRCH. The watcher process may still be alive.","triggerScenarios":"parseWatcherPidFile or tryKillPid(pid,'SIGTERM') throws non-ESRCH: corrupt pid file contents, EPERM on kill, or the pid file being unreadable.","commonSituations":"Truncated state files after a crash; watcher owned by a different user; pid file replaced by unrelated content.","solutions":["Inspect the pid file: `cat .omx/state/notify-fallback-watcher.pid` and fix/delete it","Kill the watcher manually if it is still running","Ensure consistent user ownership of .omx"],"exampleFix":"// before\ncat .omx/state/notify-fallback-watcher.pid   # garbled\n\n# after\npkill -f notify-fallback-watcher; rm .omx/state/notify-fallback-watcher.pid","handlingStrategy":"try-catch","validationCode":"function parseWatcherPidFile(raw: string): number | undefined {\n  try { const j = JSON.parse(raw); return typeof j?.pid === 'number' && Number.isInteger(j.pid) ? j.pid : undefined; } catch { return undefined; }\n}","typeGuard":null,"tryCatchPattern":"try { tryKillPid(pid,'SIGTERM'); } catch (e: unknown) { if (!hasErrnoCode(e,'ESRCH')) console.warn('[omx] warning: failed to stop notify fallback watcher process', { error: e }); }","preventionTips":["Validate pid files before signalling","Treat ESRCH as already-stopped success","Keep state dir ownership consistent"],"tags":["pid-file","signal","watcher","teardown"],"backgroundTag":"stale-pid-file","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}