{"record":{"id":"185766621869f829","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-warning-failed-to-write-notify-fallback-wat","errorCode":null,"errorMessage":"[omx] warning: failed to write notify fallback watcher pid file","messagePattern":"\\[omx\\] warning: failed to write notify fallback watcher pid file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/index.ts","lineNumber":7810,"sourceCode":"  } catch (error: unknown) {\n    console.warn(\"[omx] warning: failed to launch notify fallback 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 notify fallback watcher pid file\",\n      {\n        path: pidPath,\n        error: error instanceof Error ? error.message : String(error),\n      },\n    );\n  });\n}\n\nasync function startHookDerivedWatcher(cwd: string): Promise<void> {\n  if (process.env.OMX_HOOK_DERIVED_SIGNALS !== \"1\") return;\n\n  const { mkdir, writeFile, readFile } = await import(\"fs/promises\");\n  const pidPath = hookDerivedWatcherPidPath(cwd);\n  const pkgRoot = getPackageRoot();\n  const watcherScript = resolveHookDerivedWatcherScript(pkgRoot);\n  if (!existsSync(watcherScript)) return;\n","sourceCodeStart":7792,"sourceCodeEnd":7828,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L7792-L7828","documentation":"After launching the watcher, the CLI could not write its PID file to state (writeFile rejected, caught with .catch). The watcher runs but cannot be tracked/stopped later, so a future run may treat it as stale.","triggerScenarios":"writeFile(pidPath, JSON.stringify({pid,...})) rejects — disk full, permission lost between mkdir and write, or the state directory was removed concurrently.","commonSituations":"Disk-full CI runners; concurrent omx invocations racing to set up/tear down state; directory permissions changed mid-run.","solutions":["Free disk space and retry","Ensure only one omx instance performs setup per project at a time","Fix ownership of .omx/state"],"exampleFix":"// before\ndf -h .   # 100% full\n\n# after\ndf -h .   # free space available; rerun omx","handlingStrategy":"validation","validationCode":"import { accessSync, constants } from 'node:fs';\nfunction dirWritable(d: string): boolean {\n  try { accessSync(d, constants.W_OK); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check disk space and state-dir writability before launching watchers","Serialize watcher setup across concurrent omx runs"],"tags":["write-file","pid-file","disk-full","watcher"],"backgroundTag":"file-write-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}