Yeachan-Heo/oh-my-codex · warning

[omx] warning: failed to stop notify fallback watcher proces

Error message

[omx] warning: failed to stop notify fallback watcher process

What it means

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.

Source

Thrown at src/cli/index.ts:7902

        error: error instanceof Error ? error.message : String(error),
      },
    );
  });
}

async function stopNotifyFallbackWatcher(cwd: string): Promise<void> {
  const { readFile, unlink } = await import("fs/promises");
  const pidPath = notifyFallbackPidPath(cwd);
  if (!existsSync(pidPath)) return;

  try {
    const pid = parseWatcherPidFile(await readFile(pidPath, "utf-8"));
    if (pid) {
      tryKillPid(pid, "SIGTERM");
    }
  } catch (error: unknown) {
    if (!hasErrnoCode(error, "ESRCH")) {
      console.warn(
        "[omx] warning: failed to stop notify fallback watcher process",
        {
          path: pidPath,
          error: error instanceof Error ? error.message : String(error),
        },
      );
    }
  }

  await unlink(pidPath).catch((error: unknown) => {
    console.warn(
      "[omx] warning: failed to remove notify fallback watcher pid file",
      {
        path: pidPath,
        error: error instanceof Error ? error.message : String(error),
      },
    );
  });

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Inspect the pid file: `cat .omx/state/notify-fallback-watcher.pid` and fix/delete it
  2. Kill the watcher manually if it is still running
  3. Ensure consistent user ownership of .omx

Example fix

// before
cat .omx/state/notify-fallback-watcher.pid   # garbled

# after
pkill -f notify-fallback-watcher; rm .omx/state/notify-fallback-watcher.pid
Defensive patterns

Strategy: try-catch

Validate before calling

function parseWatcherPidFile(raw: string): number | undefined {
  try { const j = JSON.parse(raw); return typeof j?.pid === 'number' && Number.isInteger(j.pid) ? j.pid : undefined; } catch { return undefined; }
}

Try / catch

try { tryKillPid(pid,'SIGTERM'); } catch (e: unknown) { if (!hasErrnoCode(e,'ESRCH')) console.warn('[omx] warning: failed to stop notify fallback watcher process', { error: e }); }

Prevention

When it happens

Trigger: parseWatcherPidFile or tryKillPid(pid,'SIGTERM') throws non-ESRCH: corrupt pid file contents, EPERM on kill, or the pid file being unreadable.

Common situations: Truncated state files after a crash; watcher owned by a different user; pid file replaced by unrelated content.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/efa5daa20ad53628. Report an issue: GitHub.