{"record":{"id":"fb67262dd26e7cea","repo":"Yeachan-Heo/oh-my-codex","slug":"tmux-target-validation-failed-resolved-reason","errorCode":null,"errorMessage":"tmux target validation failed: ${resolved.reason}","messagePattern":"tmux target validation failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/tmux-hook.ts","lineNumber":433,"sourceCode":"    console.log(`Tracked Panes: ${panes}`);\n    if (legacySessions > 0) {\n      console.log(`Tracked Sessions (legacy): ${legacySessions}`);\n    }\n  }\n\n  console.log(`Log (today): ${existsSync(logPath) ? logPath : 'none yet'}`);\n}\n\nasync function validateTmuxHookConfig(): Promise<void> {\n  const cwd = process.cwd();\n  const { config, initResult } = await loadConfigForCommand('validate', cwd);\n  if (initResult?.usedPlaceholderTarget) {\n    return;\n  }\n  const resolved = resolveValidateTarget(config);\n\n  if (!resolved.ok) {\n    throw new Error(`tmux target validation failed: ${resolved.reason}`);\n  }\n\n  console.log('tmux-hook config is valid.');\n  console.log(`Resolved target pane: ${resolved.target}`);\n  console.log(`Mode gating: ${config.allowed_modes.join(', ')}`);\n  if (!config.enabled) {\n    console.log('Note: config is currently disabled (`enabled: false`).');\n  }\n}\n\nasync function testTmuxHook(args: string[]): Promise<void> {\n  const cwd = process.cwd();\n  const { initResult } = await loadConfigForCommand('test', cwd);\n  if (initResult?.usedPlaceholderTarget) {\n    console.log('Proceeding with placeholder target; notify-hook may log `invalid_config` skips.');\n  }\n  const pkgRoot = getPackageRoot();\n  const notifyHook = join(pkgRoot, 'dist', 'scripts', 'notify-hook.js');","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/tmux-hook.ts#L415-L451","documentation":"Thrown by the omx tmux-hook validate subcommand when the configured tmux target (session/window/pane) cannot be resolved against the running tmux server. It wraps the lower-level reason from resolveValidateTarget, e.g. tmux not installed, no such session, or malformed target spec. The check is skipped only when the init result used a placeholder target.","triggerScenarios":"Running `omx tmux-hook validate` (or the command dispatcher hitting validateTmuxHookConfig) with a --target like `session:window.pane` that does not exist, tmux not running, or tmux binary not on PATH; also when init did not use a placeholder target but config.target is stale (session renamed/closed).","commonSituations":"Renaming or killing the tmux session after `omx tmux-hook init`; running on a machine without tmux installed; copy-pasting a target spec with wrong syntax (missing colon or pane suffix); stale .omx config pointing at a dead pane.","solutions":["Run `tmux list-sessions -F '#{session_name}:#{window_index}.#{pane_index}'` and paste an exact existing target into the config/flag","Start or attach the tmux session you configured, then re-run validate","Fix target syntax: `session:window.pane` (pane optional depending on config)","If tmux is not installed, install it or run init with a placeholder target so validation is skipped"],"exampleFix":"# before\nomx tmux-hook validate --target mysession:1.0\n# tmux target validation failed: no such session\n\n# after\ntmux list-sessions -F '#{session_name}:#{window_index}.#{pane_index}'\nomx tmux-hook validate --target actual-session:0.0","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nfunction tmuxTargetExists(target: string): boolean {\n  try { execSync(`tmux display-message -p -t '${target}' '#{session_name}'`, { stdio: 'pipe', shell: '/bin/sh' }); return true; }\n  catch { return false; }\n}\n// before omx tmux-hook validate:\nif (!tmuxTargetExists(cfgTarget)) console.error(`target ${cfgTarget} not resolvable; start tmux first`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `tmux list-sessions` before validate and pass an exact session:window.pane string","Re-run `omx tmux-hook init` whenever you rename or kill the configured session","Pin the target to a stable session name instead of an index that shifts"],"tags":["tmux","cli","config-validation","target-resolution"],"backgroundTag":"tmux-target-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}