{"record":{"id":"46ff0332acb37d55","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-warning-failed-to-remove-notify-fallback-wa","errorCode":null,"errorMessage":"[omx] warning: failed to remove notify fallback watcher pid file","messagePattern":"\\[omx\\] warning: failed to remove notify fallback watcher pid file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/index.ts","lineNumber":7913,"sourceCode":"  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  });\n}\n\nasync function stopHookDerivedWatcher(cwd: string): Promise<void> {\n  const { readFile, unlink } = await import(\"fs/promises\");\n  const pidPath = hookDerivedWatcherPidPath(cwd);\n  if (!existsSync(pidPath)) return;\n\n  try {\n    const parsed = JSON.parse(await readFile(pidPath, \"utf-8\")) as {\n      pid?: number;\n    };","sourceCodeStart":7895,"sourceCodeEnd":7931,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L7895-L7931","documentation":"After stopping the watcher, unlink(pidPath) failed to remove the PID file (error swallowed). A stale pid file remains and the next run may try to kill a reused PID.","triggerScenarios":"unlink rejects with EACCES/EPERM/EROFS — file owned by another user, directory not writable, or read-only filesystem.","commonSituations":"State files created under root/sudo then used as normal user; read-only mounts; restrictive ACLs.","solutions":["Manually remove the pid file","chown/chmod the state directory for the current user","Avoid mixing sudo and non-sudo omx runs"],"exampleFix":"// before\nrm .omx/state/notify-fallback-watcher.pid   # permission denied\n\n# after\nsudo chown -R $USER .omx && rm .omx/state/notify-fallback-watcher.pid","handlingStrategy":"validation","validationCode":"import { accessSync, constants, dirname } from 'node:fs';\nfunction pathRemovable(p: string): boolean {\n  try { accessSync(dirname(p), constants.W_OK); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"await unlink(pidPath).catch((e: unknown) => { if ((e as NodeJS.ErrnoException).code !== 'ENOENT') console.warn(...); });","preventionTips":["Ensure state dir is writable by the stopping process","Treat ENOENT on unlink as success","Run teardown as the owning user"],"tags":["unlink","pid-file","permissions"],"backgroundTag":"file-delete-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}