{"record":{"id":"9c95695c222611c4","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-warning-failed-to-launch-hook-derived-watch","errorCode":null,"errorMessage":"[omx] warning: failed to launch hook-derived watcher","messagePattern":"\\[omx\\] warning: failed to launch hook-derived watcher","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/index.ts","lineNumber":7863,"sourceCode":"  await mkdir(join(omxRoot(cwd), \"state\"), { recursive: true }).catch(\n    (error: unknown) => {\n      console.warn(\n        \"[omx] warning: failed to create hook-derived watcher state directory\",\n        {\n          cwd,\n          error: error instanceof Error ? error.message : String(error),\n        },\n      );\n    },\n  );\n  let watcherPid: number | undefined;\n  try {\n    watcherPid = await launchBackgroundHelper([watcherScript, \"--cwd\", cwd], {\n      cwd,\n      env: process.env,\n    });\n  } catch (error: unknown) {\n    console.warn(\"[omx] warning: failed to launch hook-derived watcher\", {\n      cwd,\n      error: error instanceof Error ? error.message : String(error),\n    });\n    return;\n  }\n\n  if (!watcherPid) return;\n\n  await writeFile(\n    pidPath,\n    JSON.stringify(\n      { pid: watcherPid, started_at: new Date().toISOString() },\n      null,\n      2,\n    ),\n  ).catch((error: unknown) => {\n    console.warn(\n      \"[omx] warning: failed to write hook-derived watcher pid file\",","sourceCodeStart":7845,"sourceCodeEnd":7881,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L7845-L7881","documentation":"launchBackgroundHelper failed when spawning the hook-derived watcher script (e.g. ENOENT for node or the script, EACCES). The watcher is skipped; hook-driven notifications will not fire.","triggerScenarios":"Spawning [watcherScript, '--cwd', cwd] with env: process.env fails because the script path does not exist or is not executable, or the interpreter cannot be found.","commonSituations":"Corrupted/partial package install; PATH stripped in the child environment; script not executable after archive extraction; macOS Gatekeeper or SELinux blocking exec.","solutions":["Reinstall the package to restore helper scripts","chmod +x the watcher script","Ensure PATH includes the node runtime used to spawn helpers"],"exampleFix":"// before\nchmod -x node_modules/omx/dist/hooks/watcher.js\n\n# after\nchmod +x node_modules/omx/dist/hooks/watcher.js","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { which } from './which';\nfunction hookWatcherLaunchable(script: string): boolean {\n  return which('node') !== null && existsSync(script);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify helper scripts after install (npm pack integrity)","Keep node on PATH in hook environments","chmod +x shipped scripts in Dockerfiles"],"tags":["spawn","watcher","hook","exec-permission"],"backgroundTag":"child-process-spawn-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}