Yeachan-Heo/oh-my-codex · error · Error

notify-hook.js not found at ${notifyHook}

Error message

notify-hook.js not found at ${notifyHook}

What it means

The tmux-hook test subcommand needs the compiled notify-hook.js script under <package-root>/dist/scripts/ to spawn. This error means that file is missing, almost always because the package was installed from raw source without running the build step, or a publish/pack step omitted dist/.

Source

Thrown at src/cli/tmux-hook.ts:453

  console.log('tmux-hook config is valid.');
  console.log(`Resolved target pane: ${resolved.target}`);
  console.log(`Mode gating: ${config.allowed_modes.join(', ')}`);
  if (!config.enabled) {
    console.log('Note: config is currently disabled (`enabled: false`).');
  }
}

async function testTmuxHook(args: string[]): Promise<void> {
  const cwd = process.cwd();
  const { initResult } = await loadConfigForCommand('test', cwd);
  if (initResult?.usedPlaceholderTarget) {
    console.log('Proceeding with placeholder target; notify-hook may log `invalid_config` skips.');
  }
  const pkgRoot = getPackageRoot();
  const notifyHook = join(pkgRoot, 'dist', 'scripts', 'notify-hook.js');
  if (!existsSync(notifyHook)) {
    throw new Error(`notify-hook.js not found at ${notifyHook}`);
  }

  const threadId = `tmux-test-${Date.now()}`;
  const turnId = `turn-${Date.now()}`;
  const message = args.join(' ').trim() || 'tmux-hook test payload';
  const payload = {
    type: 'agent-turn-complete',
    cwd,
    'thread-id': threadId,
    'turn-id': turnId,
    'input-messages': ['omx tmux-hook test'],
    'last-assistant-message': message,
  };

  const result = spawnSync(process.execPath, [notifyHook, JSON.stringify(payload)], {
    cwd,
    encoding: 'utf-8',
      windowsHide: true,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run the package build (`npm run build` / `npm run prepare`) to regenerate dist/scripts/notify-hook.js, then retry
  2. If installed from npm, reinstall the package (`npm install <pkg> --force`) — published builds should ship dist
  3. Verify getPackageRoot() resolves to the expected directory (no symlink weirdness) and that dist/scripts exists

Example fix

# before
omx tmux-hook test hello
# Error: notify-hook.js not found at /app/node_modules/omx/dist/scripts/notify-hook.js

# after
cd /app/node_modules/omx && npm run build
omx tmux-hook test hello
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { join } from 'node:path';
const hook = join(pkgRoot, 'dist', 'scripts', 'notify-hook.js');
if (!existsSync(hook)) {
  console.error('dist not built — run npm run build in the package before tmux-hook test');
  process.exit(2);
}

Prevention

When it happens

Trigger: Running `omx tmux-hook test ...` when dist/scripts/notify-hook.js does not exist relative to getPackageRoot() — e.g. cloned repo without `npm run build`, partially installed package, or dist/ cleaned by a clean script.

Common situations: Developing from a git clone; CI cache pruned dist/; installing with package managers that strip build artifacts; version upgrades where build output layout changed.

Related errors


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