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

tmux-hook config missing. Run: omx tmux-hook init

Error message

tmux-hook config missing. Run: omx tmux-hook init

What it means

readValidatedConfig could not find the tmux-hook config file on disk (the existsSync check failed), so the command cannot proceed. The error message directs the user to run the init subcommand that scaffolds the config.

Source

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

  return {
    enabled: parsed.enabled,
    target: { type: targetObj.type, value: targetObj.value },
    allowed_modes: allowedModes,
    cooldown_ms: cooldown,
    max_injections_per_session: maxInjections,
    prompt_template: promptTemplate,
    marker,
    dry_run: parsed.dry_run,
    log_level: parsed.log_level,
    skip_if_scrolling: parsed.skip_if_scrolling === false ? false : true,
  };
}

async function readValidatedConfig(cwd = process.cwd()): Promise<TmuxHookConfig> {
  const configPath = tmuxHookConfigPath(cwd);
  if (!existsSync(configPath)) {
    throw new Error('tmux-hook config missing. Run: omx tmux-hook init');
  }
  const content = await readFile(configPath, 'utf-8');
  return parseConfig(JSON.parse(content));
}

async function loadConfigForCommand(
  commandName: 'status' | 'validate' | 'test',
  cwd = process.cwd(),
): Promise<{ config: TmuxHookConfig; initResult: InitConfigResult | null }> {
  const configPath = tmuxHookConfigPath(cwd);
  let initResult: InitConfigResult | null = null;

  if (!existsSync(configPath)) {
    initResult = await initTmuxHookConfig({ silent: true, cwd });
    if (initResult.created) {
      console.log(`No tmux-hook config found. Created ${initResult.configPath}.`);
      if (initResult.detectedSession) {
        console.log(`Detected tmux session: ${initResult.detectedSession}`);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run omx tmux-hook init to scaffold the config, then retry
  2. Verify you are in the project root where .omx/ lives
  3. If config exists elsewhere, run from the directory containing the .omx directory

Example fix

# before
omx tmux-hook install  # Error: config missing
# after
omx tmux-hook init && omx tmux-hook install
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync(join(cwd, '.omx', 'tmux-hook.json'))) {
  await exec('omx tmux-hook init');
}

Try / catch

try { await hookCommand(); } catch (e) { if (e instanceof Error && e.message.includes('config missing')) { await exec('omx tmux-hook init'); await hookCommand(); } else throw e; }

Prevention

When it happens

Trigger: Running `omx tmux-hook install` (or any config-requiring subcommand) before `omx tmux-hook init`; deleting or moving the .omx/tmux-hook config; running from a directory without an initialized .omx root.

Common situations: Fresh clones or new machines where init was never run; wrong working directory (config path is cwd-relative); clean scripts that wipe local state.

Related errors


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