{"record":{"id":"8176159cfa7d4ba1","repo":"Yeachan-Heo/oh-my-codex","slug":"omx-warning-failed-to-create-notify-fallback-wa","errorCode":null,"errorMessage":"[omx] warning: failed to create notify fallback watcher state directory","messagePattern":"\\[omx\\] warning: failed to create notify fallback watcher state directory","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/index.ts","lineNumber":7752,"sourceCode":"async function startNotifyFallbackWatcher(\n  cwd: string,\n  options: { codexHomeOverride?: string; enableAuthority?: boolean; sessionId?: string } = {},\n): Promise<void> {\n  const { mkdir, writeFile } = await import(\"fs/promises\");\n  const pidPath = notifyFallbackPidPath(cwd);\n  const reapResult = await reapStaleNotifyFallbackWatcher(pidPath);\n  if (reapResult === \"recent_active\") return;\n\n  if (!shouldEnableNotifyFallbackWatcher(process.env, process.platform)) return;\n\n  const pkgRoot = getPackageRoot();\n  const watcherScript = resolveNotifyFallbackWatcherScript(pkgRoot);\n  const notifyScript = resolveNotifyHookScript(pkgRoot);\n  if (!existsSync(watcherScript) || !existsSync(notifyScript)) return;\n\n  await mkdir(join(omxRoot(cwd), \"state\"), { recursive: true }).catch(\n    (error: unknown) => {\n      console.warn(\n        \"[omx] warning: failed to create notify fallback watcher state directory\",\n        {\n          cwd,\n          error: error instanceof Error ? error.message : String(error),\n        },\n      );\n    },\n  );\n  const watcherEnv = buildNotifyFallbackWatcherEnv(process.env, {\n    codexHomeOverride: options.codexHomeOverride,\n    omxRootOverride: resolveOmxRootForLaunch(cwd, process.env),\n    enableAuthority: options.enableAuthority === true,\n    sessionId: options.sessionId,\n  });\n  let watcherPid: number | undefined;\n  try {\n    watcherPid = await launchBackgroundHelper(\n      [","sourceCodeStart":7734,"sourceCodeEnd":7770,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L7734-L7770","documentation":"The CLI tried to create the state directory (<omxRoot>/state) needed to track the notify fallback watcher, and mkdir failed (wrapped in .catch so execution continues). The watcher subsystem will be degraded because its PID file cannot be written.","triggerScenarios":"ensureWatcherSetup path where mkdir(join(omxRoot(cwd),'state'), {recursive:true}) rejects — permission denied, read-only filesystem, or a file exists where the directory should be.","commonSituations":"Project directory owned by root while running as a normal user; .omx directory made read-only; a file named 'state' already exists in the omx root; read-only container filesystems.","solutions":["Check permissions of the .omx directory: `ls -la .omx` and `chmod`/`chown` as needed","Remove any regular file blocking creation of the state directory","If on a read-only FS, point the omx root/state dir to a writable location via config or env"],"exampleFix":"// before\nmkdir .omx/state  # EEXIST: file 'state'\n\n// after\nrm .omx/state && mkdir -p .omx/state","handlingStrategy":"validation","validationCode":"import { existsSync, statSync, accessSync, constants } from 'node:fs';\nfunction stateDirWritable(root: string): boolean {\n  const dir = `${root}/state`;\n  if (existsSync(dir)) { try { accessSync(dir, constants.W_OK); return statSync(dir).isDirectory(); } catch { return false; } }\n  try { accessSync(root, constants.W_OK); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create .omx/state with correct ownership in setup scripts","Never mix sudo and non-sudo runs","Keep the project on a writable filesystem"],"tags":["mkdir","permissions","watcher","filesystem"],"backgroundTag":"directory-creation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}